CSS CSS Tutorial CSS Advanced CSS Responsive Web Design(RWD) CSS Grid CSS Properties Sass Tutorial Sass Functions



scroll-margin-left

The scroll-margin-left property is a CSS property that is used to set the margin between the left edge of an element and the start of its scrollable area. This property is used to create a space between the edge of an element and its scrollable area, which can be useful in situations where the content of an element is partially hidden by its scrollable area.

The scroll-margin-left property is a part of the CSS Scroll Snap Module Level 1, which provides a way to create scroll snap points that allow users to easily scroll to specific points on a page. This property is supported by most modern web browsers, including Chrome, Firefox, Safari, and Edge.

Usage

The scroll-margin-left property can be used on any element that has a scrollable area, such as a <div> or <iframe> element. The value of this property can be specified in any valid CSS length unit, such as pixels, ems, or percentages.

Here is an example of how to use the scroll-margin-left property:

<div style="scroll-margin-left: 20px;">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, velit eget ultrices bibendum, velit elit bibendum elit, vel bibendum elit elit vel elit.</p>
  <p>Sed euismod, velit eget ultrices bibendum, velit elit bibendum elit, vel bibendum elit elit vel elit.</p>
  <p>Velit elit bibendum elit, vel bibendum elit elit vel elit.</p>
</div>

In this example, the scroll-margin-left property is set to 20 pixels, which creates a space between the left edge of the <div> element and the start of its scrollable area.

Browser Support

The scroll-margin-left property is supported by most modern web browsers, including Chrome, Firefox, Safari, and Edge. However, it is not supported by Internet Explorer.

Conclusion

The scroll-margin-left property is a useful CSS property that can be used to create a space between the edge of an element and its scrollable area. This property is supported by most modern web browsers and can be used on any element that has a scrollable area.

References

Activity