I'm using a <br>
tag inside a heading (e.g. h1
), and as part of my responsive design with progressive enhancement (would this be an exception?) — I would like to hide it on narrower viewports.
Naturally, the CSS rule is:
h1 br {
display: none;
}
But what is the correct way to approach this in the HTML?
If it put it as this, then when the br
is hidden, there is no space between "heading" and "with":
1) <h1>Example heading<br>with a break right thurr</h1>
So is the following semantically correct?
2) <h1>Example heading <br>with a break right thurr</h1>
Or what about this?
3) <h1>Example heading<br> with a break right thurr</h1>
Very nit-picky, I know, but I'm curious to hear.
P.S. In this case, one absolutely must use a br
because the words "Example heading" are shorter than "with a break right thurr" — using a fluid container would force the break in a place that isn't desired.
Also, as David pointed out, both examples #2 and #3 will work — but are they semantically correct? While spaces around HTML tags are semantic and are ignored (that's how we make markup nice to read)... but what about spaces inside element tags? Should they be there?
word` semantic? *(Edit: It doesn't show, but I put like 5 spaces on either side.)* Reminds me of people using `word word` instead of CSS — haha :P – Baumr Nov 03 '12 at 20:23