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.
Floats not cleared?
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.
Actually. You can set it in the parent p.
:
p {
}
That’s it. No need to use clear floats.
Because you set position:relative, if the child element is positioned in absolute position, it will not be able to open the parent p