My ul and li have not set the width and height, but subclasses img and P of subclasses have set the width and height. Why is ul’s height 0?
Subclasses did not support him
For example, neither the div.content-inner nor ul#p-1 has any width or height.
But when the page elements are examined, the width and height are displayed. What is the matter? Does it have anything to do with the width and height of the descendant elements?
Why do div and ul still not show the width and height when I do this?
The visual inspection is because li used float, so ul can’t support the height.
It seems that I was the first to answer this question … the result was ignored by the questioner. the questioner did not give the following li style, so I was not sure at first. when you asked others, it was float’s question that did not run away.
There are three solutions: parent tag add overflow:auto/ floating tag finally add an empty element of clear:both/parent tag use: after pseudo class to define a hidden block of clear:both