Skip to content
Related Articles

Related Articles

Improve Article

CSS scroll-padding-right Property

  • Last Updated : 07 Sep, 2020

The scroll-padding-right property is used to set all the padding to the right of an scroll container or element at once. The value specified for the scroll-padding-right determines how much of the page that is primarily outside the snap scroll should remain visible.

Syntax:

scroll-padding-right: keyword_values

Or

scroll-padding-right: length_values

Or

scroll-padding-right: 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 exp: px, em, vh, % 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 if the non-zero value is more appropriate.
  • Global_Values: This property refers to the global values like inherit, initial, unset, etc.

Example: Below example illustrates the scroll-padding-right property.

HTML




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

Output:

Supported Browsers:

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :