.main_box_rightbox {
width: 950px;
height: auto;
float: left;
margin-left: 5px;
margin-top: 3px;
position: relative;
}
这样之后mainboxrightbox 高度只有16px
这是为什么??
有内容!!
ringa_lee2017-04-17 11:22:58
I can’t see all your code. I estimate the possible reasons:
1. The float is not cleared, causing the height to not be expanded.
2. The content is empty, causing the height to not be expanded. height:auto Automatically adjust the height based on the content within the block.
迷茫2017-04-17 11:22:58
Actually. You can set it in the parent p.
:
p {
overfloat: hidden;
}
That’s it. No need to use clear floats.
PHPz2017-04-17 11:22:58
Because you set position:relative, if the child element is positioned in absolute position, it will not be able to open the parent p