CSS scroll-padding-inline-start Property
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 vertical-lr or vertical-rl writing mode respectively where horizontal-tb stands for horizontal top-to-bottom and vertical-rl or vertical-lr stands for vertical right-to-left and vertical 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 68 and above
- Chrome 69 and above
- Edge 79 and above
- Opera 56 and above
- Safari 15 and above
Please Login to comment...