CSS scroll-padding-right Property
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; } .w3wiki { width: 300px; height: 300px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scroll-snap-type: x mandatory; } </ style > </ head > < body > < div class = "w3wiki" style = "scroll-padding-right: 90px;" > < img src = "https://media.w3wiki.net/wp-content/uploads/20200723131450/img6-300x82.png" class = "geek" > < img src = "https://media.w3wiki.net/wp-content/uploads/20200723131449/img5.jpeg" class = "geek" > < img src = "https://media.w3wiki.net/wp-content/uploads/20200723131450/img6-300x82.png" class = "geek" > < img src = "https://media.w3wiki.net/wp-content/uploads/20200723131452/img4-300x167.png" class = "geek" > < img src = "https://media.w3wiki.net/wp-content/uploads/20200723131450/img6-300x82.png" class = "geek" > </ div > </ body > </ html > |
Output:
Supported Browsers:
- Chrome 69
- Firefox 68
- Edge 79
- Opera 56
- Safari 14.1