::before或::after伪类改变父元素高度
一、介绍
当父元素设置高度为100%时,那么其伪类(::before和::after),可以设置padding-top或padding-bottom改变父元素高度。
如:父元素设置如下
<style>
.nav{
width: 200px;
height: 100%;
background-color: red;
}
</style>
<div class="father"></div>
原创
2022-02-25 13:09:13 ·
2805 阅读 ·
0 评论