inherit 继承父元素 定位
举例 :
<div class="father">
<p></p>
</div>
div{
position:fixed;
left:0;
top:0;
}
p{
position:inherit;//继承了父元素的fixed;此时就会相对于浏览器定位;不会相对于父元素定位,阿懂?
left:10000px;
top:1000px;
}
本文详细介绍了CSS中inherit属性的应用,特别是如何使用position:inherit来使子元素继承父元素的定位方式。通过具体示例展示了当子元素设置为position:inherit时,会遵循父元素的定位类型,而非默认定位。
inherit 继承父元素 定位
举例 :
<div class="father">
<p></p>
</div>
div{
position:fixed;
left:0;
top:0;
}
p{
position:inherit;//继承了父元素的fixed;此时就会相对于浏览器定位;不会相对于父元素定位,阿懂?
left:10000px;
top:1000px;
}
转载于:https://www.cnblogs.com/520BigBear/p/9075862.html
1887
1万+

被折叠的 条评论
为什么被折叠?