CSS scroll-padding-left Property
The scroll-padding-left property is used to set all the padding to the left of an scroll container or element at once. The value specified for the scroll-padding-left determines how much of the page that is primarily outside the snapsort should remain visible.
Syntax:
scroll-padding-left:length_values
Or
scroll-padding-left:keyword_values
Or
scroll-padding-left: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.
- 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 a 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-left property.
HTML
<!DOCTYPE html> < html > < head > < style > .geek { width: 275px; height: 300px; border: 2px solid red; scroll-snap-align: none start; } .GeeksforGeeks { width: 300px; height: 300px; border: 2px solid green; text-align: center; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scroll-snap-type: x mandatory; } </ style > </ head > < body > < div class = "GeeksforGeeks" style = "scroll-padding-left: 80px;" > < 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
- Opera
- Edge
- Safari (Partially Supported)
- Internet Explorer (Not Supported)