正确使用HTML5< hr>标签 [英] Correct usage of HTML5 <hr> tag

查看:200
本文介绍了正确使用HTML5< hr>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一家公司写一个新的网页,并且我有一个(理智的一部分)HTML5 / W3C建议。

I'm writing a new webpage for a company and I have (a sane subset of) HTML5/W3C recommendations in mind.

阅读后的语义含义< hr /> ,我想知道这是否是一个使用它的好地方:

After reading the semantic meaning of <hr />, I was wondering if this was a good place to use it:

<section name="historyItem">
    <h2>2002</h2>
    <p>Dolorem ipsum dolor sit amet in 2002, consectetur [...]</p>
    <hr />
    <ul>
        <li><a href="#">Link A</a></li>
        <li><a href="#">Link B</a></li>
    </ul>
</section>

我的理由是,是的,< hr /> ; 表示从部分描述部分链接的主题更改,但我不确定。

My line of reasoning is that, yes, that <hr /> represents a thematic change from section description to section links, but I'm unsure about that.

也许主题变化意味着稍后在另一个主题上有一个新段落,因此我的例子不会是正确的。您怎么看?

Maybe "thematic change" means to have a new paragraph later on another subject, and thus my example wouldn't be "correct". What do you think?

(ps:是的,< ul> 是CSS样式的单行,看起来很酷)

(ps.: Yes, that <ul> is CSS-styled to fit a single line and look cool)

推荐答案

我明白你的意思了。但我个人不会打扰。问问自己为什么要首先使用标签。如果你想描述段落和链接之间的变化,那么就纯粹标记而言,我不认为它是必需的。如果它是关于页面的外观(即你想要划定两个区域的规则),那么我再次质疑它的用处,因为你可以将一个边框应用于段落或无序列表标签。

I see what you mean. But personally I just wouldn't bother. Ask yourself why you're using the tag in the first place. If you want to delineate a change between the paragraph and the links, then in terms of pure mark-up I don't reckon it's required. If it's about the look and feel of your page (i.e. you want a rule demarcating the two areas), then again I'd question its usefulness, given that you can apply a border to either the paragraph or unordered list tags.

当然,鉴于这是html5,你可以全力以赴并使用< section> 标签...

Of course, given that this is html5, you could go the whole hog and use the <section> tag…

这篇关于正确使用HTML5&lt; hr&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆