【发布时间】:2012-03-13 16:50:22
【问题描述】:
这里是html:
<section class="category">
<p><a href="product-list.html">Lorem ipsum dolor sed diam</a></p>
<p><a href="product-list.html">Lorem ipsum dolor sed diam</a></p>
<p><a href="product-list.html">Lorem ipsum dolor sed diam</a></p>
<p><a href="product-list.html">Lorem ipsum dolor sed diam</a></p>
<section class="clear"></section>
</section>
如何替换标签 p --> li 并用标签 ul 包装组 li 。我需要它:
<section class="category">
<ul>
<li><a href="product-list.html">Lorem ipsum dolor sed diam</a></li>
<li><a href="product-list.html">Lorem ipsum dolor sed diam</a></li>
<li><a href="product-list.html">Lorem ipsum dolor sed diam</a></li>
<li><a href="product-list.html" >Lorem ipsum dolor sed diam</a></li>
</ul>
<section class="clear"></section>
</section>
【问题讨论】:
-
提示:不需要 clear-element (
section.clear),只需使用简单的 clearfix-solutions 之一(父级上的overflow: hidden;就足够了)。另外,如果您坚持使用 html 元素来清除浮动,为什么要使用语义section元素?section不是在这里替换div,它在这里为我们过去使用 div 的一些东西提供意义。但是,在清除元素的情况下,section不合适,div合适。
标签: jquery html jquery-ui jquery-selectors