Skip to content
Related Articles

Related Articles

Improve Article

CSS scroll-padding-inline-start Property

  • Last Updated : 09 Sep, 2020

The scroll-padding-inline-start property is used to set all the scroll padding to the start edge of a scroll element or container in the inline dimension at once. The start side is the left side for horizontal-tb writing mode and top or bottom side for verticle-lr or verticle-rl writing mode respectively where horizontal-tb stands for horizontal top-to-bottom and verticle-rl or verticle-lr stands for verticle right-to-left and verticle left-to-right respectively.

Syntax:

scroll-padding-inline-start: keyword_values

Or

scroll-padding-inline-start: length_values

Or

scroll-padding-inline-start: Global_Values

Property values: This property accepts three properties mentioned above and described below.



  • length_values: This property refers to the values defined with length units. Ex: px, em, vh, % etc.
  • Global_Values: This property refers to the global values like inherit, initial, unset, etc.
  • keyword_values: This property refers to the keyword_values defined with units like auto. Generally this will be set to 0px by default but it can be non-zero value as well as if the non-zero value is more appropriate.

Example: In this example, you can see the effect of scroll-padding-inline-start by scrolling to a point partway between the two of the “interfaces” of the example’s content.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        .geeks {
            width: 270px;
            height: 300px;
            scroll-snap-align: none start;
        }
  
        .GeeksforGeeks {
            width: 300px;
            height: 300px;
            border: 2px solid green;
            overflow-x: auto;
            overflow-y: hidden;
            white-space: nowrap;
            scroll-snap-type: x mandatory;
        }
    </style>
</head>
  
<body>
    <div class="GeeksforGeeks" style=
        "scroll-padding-inline-start: 90px;">
  
        <img src=
            class="geeks">
        <img src=
            class="geeks">
        <img src=
            class="geeks">
        <img src=
            class="geeks">
        <img src=
            class="geeks">
        <img src=
            class="geeks">
    </div>
</body>
  
</html>

Output:

Supported Browsers:

  • Firefox
  • Chrome
  • Edge
  • Opera
  • Safari (Not Supported)
  • Internet Explorer (Not Supported)



My Personal Notes arrow_drop_up
Recommended Articles
Page :