I'm writing a new webpage for a company and I have (a sane subset of) HTML5/W3C recommendations in mind.
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>
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.: Yes, that <ul>
is CSS-styled to fit a single line and look cool)
The <hr> tag defines a thematic break in an HTML page (e.g. a shift of topic). The <hr> element is most often displayed as a horizontal rule that is used to separate content (or define a change) in an HTML page.
HTML - <hr> Tag The HTML <hr> tag is used for creating a horizontal line. This is also called Horizontal Rule in HTML.
The attributes of the <hr> tag are not supported in HTML5, instead, we use CSS styles.
It's proper to use it when you have, say, several paragraphs with two distinct themes. If you'd like to otherwise separate themes among images and content, I believe this is also appropriate. The new use of hr seems to just be for distinguishing topics within HTML.
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.
Of course, given that this is html5, you could go the whole hog and use the <section>
tag…
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With