hodgson

CSS中height:100%和height:inherit的异同

https://www.zhangxinxu.com/wordpress/2015/02/different-height-100-height-inherit/

这篇已经讲的很清楚了。

绝对定位,高度height:100%,向上查找有效高度,直到最底层,因此,在没有有效高度的情况下,高度为页面显示高度。

当父级元素为相对定位的时候,高度与父级一致。

当父级高度被撑开的时候,设置父级,position:relative,子级,position:absolute;width:100%;heigth:100%;

 

想要子集在父级容器中滑动,父级设置overflow:auto,且高度确定。因此一般使用flex布局来实现。

 

分类:

技术点:

相关文章:

  • 2021-10-29
  • 2022-12-23
  • 2021-07-27
  • 2021-12-26
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2022-01-28
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-02-08
相关资源
相似解决方案