What to do if css3 sticky does not take effect

藏色散人
Release: 2023-01-04 09:36:44
Original
7138 people have browsed it

css3 sticky solution does not take effect: 1. The parent element cannot have overflow:hidden or overflow:auto attributes; 2. One of the four values ​​​​of top, bottom, left, and right must be specified; 3. The height of the parent element Cannot be lower than the height of the sticky element.

What to do if css3 sticky does not take effect

The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.

Recommendation: "css video tutorial"

sticky does not take effect for the following reasons:

  • parent The element is set with overflow:hidden or overflow:auto

  • No one of the four values ​​​​of top, right, bottom, and left is specified

  • Parent The height of the element is less than the height of the sticky-positioned element

  • The sticky attribute depends on the user's scrolling, switching between position:relative and position:fixed positioning.

  • Element positioning is relative positioning before crossing a specific threshold, and fixed positioning thereafter.

The sticky attribute is only valid when the following conditions are met:

  • The parent element cannot be overflow:hidden or overflow:auto attribute

  • Must specify one of the four values ​​​​top, bottom, left, right, otherwise it will only be in relative positioning

  • The height of the parent element cannot be lower than the height of the sticky element

The above is the detailed content of What to do if css3 sticky does not take effect. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!