CSS positioning and scroll bars

0805 self-summary

A. Absolute positioning

position: absolute;

/*绝对定位:
1、定位属性值:absolute
2、在页面中不再占位(浮起来了),就无法继承父级的宽度(必须自己自定义宽度)
3、一旦定位后,定位的布局方位 top、bottom、left、right都能参与布局
4、绝对定位的参考系是最近的定位父级(不是父级中的哪一点,而是四边参照四边)
5、左右同时存在,取左;同理上下取上
6、当父级定位了,子级参照父级定位,又可以重新获取父级宽度(也可以在计算中拿到父级高度)
*/

position:fixed

Generate absolute positioning of elements relative to the browser window positioning.

II. Relative positioning

position: relative;

Parent (parent recent) positioned opposite the object

1) does not affect the layout itself

2) Auxiliary absolute positioning themselves Layout

Three default positioning

position: static

Defaults. No positioning element occurs in the normal flow (ignoring top, bottom, left, right or z-index statement).

IV. Inherits targeting

position:inherit

Provision should inherit the value of the position property from the parent element.

V. scrollbar

overflow

  • hidden: no scroll bars, and only the content specified content area.
  • visible: The default value is no scroll bar, how about this property defines overflow element's content area will be processed and displayed.

  • scroll: this attribute defines overflow element's content area will be how to deal with. If the value scroll, regardless of whether the user agent will provide a scrolling mechanism. Therefore, it is possible even if you can put aside all the content elements box will appear scroll bar.

  • auto: scroll bars, and only the content specified content area.

Guess you like

Origin www.cnblogs.com/pythonywy/p/11305321.html