什么是最好的方法来编码标题/标题为< ul>或< ol>,像我们有< caption>在< table> ;? [英] What would be the best method to code heading/title for <ul> or <ol>, Like we have <caption> in <table>?
问题描述
< ul>
或< ol>
的标题/标题的最佳方法是什么? ?像我们在< table>
中有< caption>
,我们不想让它们加粗。
What would be the best method to code heading/title of <ul>
or <ol>
? Like we have <caption>
in <table>
, and we don't want to make them bold.
这是否正确?
<p>heading</p>
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
还是应该使用标题?
<h3|4|5|6>heading</h3|4|5|6>
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
推荐答案
始终使用标题标题。线索的名字是:)
Always use heading tags for headings. The clue is in the name :)
如果你不想让它们是粗体,用CSS改变他们的风格。例如:
If you don’t want them to be bold, change their style with CSS. For example:
<h3 class="list-heading">heading</h3>
<ul>
<li>list item </li>
<li>list item </li>
<li>list item </li>
</ul>
CSS
CSS
.list-heading {
font-weight: normal;
}
在HTML5中,您可以使用< section>
元素。 (< section>
在IE 8和更早版本中无法正常工作,但没有使用JavaScript。)
In HTML5, you can associate the heading and the list more clearly by using the <section>
element. (<section>
doesn’t work properly in IE 8 and earlier without some JavaScript though.)
<section>
<h1>heading</h1>
<ul>
<li>list item </li>
<li>list item </li>
<li>list item </li>
</ul>
</section>
您可以在HTML 4中执行类似操作:
You could do something similar in HTML 4:
<div class="list-with-heading">
<h3>Heading</h3>
<ul>
<li>list item </li>
<li>list item </li>
<li>list item </li>
</ul>
</div>
然后风格如下:
.list-with-heading h3 {
font-weight: normal;
}
这篇关于什么是最好的方法来编码标题/标题为< ul>或< ol>,像我们有< caption>在< table> ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!