Open In App

CSS scroll-padding-right Property

Improve
Improve
Like Article
Like
Save
Share
Report

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 69
  • Firefox 68
  • Edge 79
  • Opera 56
  • Safari 14.1


Last Updated : 30 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads