gpt4 book ai didi

html - 最适合用于 "clear: both;"目的的 HTML5 元素是什么?

转载 作者:太空狗 更新时间:2023-10-29 15:42:23 24 4
gpt4 key购买 nike

我有:

<section>
<ul>
<li>....</li>
<li>....</li>
<li>....</li>
..
</ul>
</section>

我想要 <li>向左浮动并在这些 <li> 的末尾, 在 </ul> 之后,我需要将一个元素作为 clear: both;为了保持section s block 完整性。

哪个 html5 元素最适合这个目的?我应该去隐形吗 hr ?一个div

谢谢。

最佳答案

,在适当的地方使用溢出:隐藏技巧。

如果这不合适,请使用伪元素。例如,您可以使用...

ul:after { 
content: "";
clear: both;
display: block;
}

关于html - 最适合用于 "clear: both;"目的的 HTML5 元素是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10563311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com