Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the four common attribute values of position in css

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you what are the four common attribute values of position in css. I believe most people don't know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.

1. Default location of static.

In general, we don't need to declare it specifically, but sometimes when we encounter inheritance, we don't want to see the attributes inherited by the element affect itself, so we can use Position:static to cancel inheritance, that is, to restore the default value of element positioning. The element set to static is always in the position given by the page flow (the static element ignores any top, bottom, left, or right declarations). It's not usually used.

2. Relative relative positioning. Relative positioning is relative to the default position of the element.

The value of the top,right,bottom,left it offsets is based on its original location, regardless of what happens to other elements. Notice that the position of the element moved by relative still occupies space.

3. Absolute absolute positioning.

Set to the absolute element, and offset based on the parent container if its parent container is set to the position attribute and the position property value is absolute or relative. If the parent container does not set the position property, the offset is based on body. Note that the element that sets the absolute attribute does not occupy a place in the standard stream.

4. Fixed fixed positioning.

The location is set to the fixed element and can be positioned to the specified coordinates compared to the browser window. Regardless of whether the window is scrolled or not, the element remains in that position. It is always based on body. Note that the element that sets the fixed attribute does not occupy a place in the standard flow.

These are all the contents of the article "what are the four common attribute values of position in css?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report