
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Disabling Scroll Anchoring with CSS
To disable the default scroll anchoring provided by web browsers, we can use the overflowanchor property.
Example
The following example gives an idea of overflow-anchor property −
<!DOCTYPE html> <html> <head> <style> body { overflow-anchor: none; } div{ display: flex; flex-direction: row; } </style> </head> <body> <div><img src="https://images.unsplash.com/photo-1613061588991- 6dd130548bc7?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=400&ixlib=rb1.2.1&q=80&w=160" /> <img src="https://images.unsplash.com/photo-1612129717112- 9d1274034547?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=400&ixlib=rb1.2.1&q=80&w=160" /> <img src="https://images.unsplash.com/photo-1613079936591- 8ce270890241?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=400&ixlib=rb1.2.1&q=80&w=160" /> <img src="https://images.unsplash.com/photo-1612454902143- 328050834c9e?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=400&ixlib=rb1.2.1&q=80&w=160" /> </div> <h2>Test overflow</h2> </body> </html>
Output
This will produce the following result −
- Related Articles
- CSS overflow: scroll
- CSS scroll-behavior Property
- How to change background images on scroll with CSS?
- HTML Tables with Fixed Header on Scroll in CSS
- How to create a scroll indicator with CSS and JavaScript?
- Disabling Pull-to-Refresh Feature on Mobile Browsers using CSS
- How to create a "scroll back to top" button with CSS?
- How to create a gradient background color on scroll with CSS?
- How to shrink a header on scroll with CSS and JavaScript?
- How to Create an On Scroll Fixed Navigation Bar with CSS?
- How to resize a navigation bar on scroll with CSS and JavaScript?
- How to hide a navigation menu on scroll down with CSS and JavaScript?
- How to create a fixed/sticky header on scroll with CSS and JavaScript?
- Scroll Element into View with Selenium.
- Disabling Android's chrome pull-down-to-refresh feature with HTML.

Advertisements