The <br />
tag seems to get short shrift a lot. Perhaps because it contains no content and appears to have no meaning within a document. You can’t communicate any of the information that a line-break contains structurally because it seems to be a purely presentational element.
Robert Nyman boils the issue down to a number of different perspectives on line breaks: “no”, “yes”, “I don’t know”, and “who cares?” (Perspectives have been paraphrased. A lot.)
I’m not firmly on one side or the other – I can’t help sitting on the fence on this question. There are pieces of information which, to me, seem to be best presented using line breaks. Take an address, for example. You can do it in a single <address>
element without line breaks – and it’s OK, but not really the standard presentation of an address. Most people expect an address to cross multiple lines, after all. Saying we don’t use line breaks, this can be a bit tricky. It seems hardly semantic to put each line of an address into a separate address element – since each line is only a part of the whole.
So using line breaks is pretty standard for an address. Conceivably, a more semantic layout would actually be in definition list format where the definition term is the person’s name and each definition part is the address. This would still require multiple <address>
elements, however, since a single element couldn’t span multiple <dd>
tags, but the address would still require line breaks if used in a single definition element.
So, ultimately, using a definition list may be the most semantic way of expressing an address, but line breaks unquestionably require much less code. The semantic cost is really not too much for me to pay, personally.
I don’t think that a line break has semantic value. However, there are situations where a line break is required because custom dictates it. Other methods of formatting may have their value, but the use of an occasional line break isn’t going to make or break a site’s quality code.
Joe Dolson
@Kevin Yes, technically the
address
element is intended to represent information about the author of a document. It can be argued, of course, that if you’re enclosing a full business address, including the business name, that what you’re enclosing is the contact information for the substantive document author. But it’s not entirely accurate.So it depends, in my view; there are cases when using
address
for an address is appropriate; but it is not appropriate in all cases.As far as
br
goes, as I state above, line breaks do carry semantic meaning in the division of content. I think that abr
is appropriate at any point where the text is more easily understood by the insertion of a line break.In your case specifically, as long as the author of the quote is also wrapped in a
cite
element, I think you’re fine. I’ve done that myself.Kevin Frey
I know this is an old post. I was looking for information on the br tag because I’m wondering about citing an author of a quote within the blockquote tag. I thought a line break would make the most sense, particularly because it’s not just the quote author, but also his position, his company, and the date. Commas just don’t seem to do justice when it comes to the aesthetics.
Also, I see some comments about the address tag. It was my understanding that this tag was meant to encapsulate a document’s author information, and not a street address. Is that correct? If it is, does that make using the tag for a street address LESS semantic?
Jeremy
Just curious, would you consider semantic for code. Even though there is a
tag for this already, is seems more appropriate to me to surround an entire code snippet within a
tag and then each individual line.
Kenny
I agree with the above statement 100%.
Joe Dolson
It seems like the point is, ultimately, that there are situations where a
br
is the only practical way of creating a needed separation. Barring the creation of numerous new elements to suit every situation where you might need a line break — such asline
for poetry,street
andcity
for addresses, etc. — the only practical means of enforcing an expected line break isbr
.I think the difficulty is largely with a human tendency to perceive that only substance contains meaning:
br
is an element which provides meaning through empty space.Maybe. 🙂
Rob
This is a difficult one. I’m a bit of a CSS (Cascading Style Sheets) purist, but having said that using br tags have remained in my repertoire.
I guess the conclusion is, it’s a personal choice.
Joe Dolson
Best way of putting that I’ve heard — clearly, if a passage makes no sense without a line break, it must have a line break. If there is no available markup which makes more semantic sense for the context, a line break is the best semantic choice.
Thanks for your comment!
brandaggio
A
<br>
is semantic if your rendered page calls for a line break.I believe a good way of ascertaining the semantic value of a line break is turning off CSS (Cascading Style Sheets) – at least for those that are skeptical.
There is no “fence” to be on so to speak – either you call for a line break (as you might if using an old fashioned typewriter) or you don’t.
If you actually have something that constitutes a paragraph you of course use the
<p>
tag – but unlike a<br>
you wouldn’t do it for the space/break it creates. If you have something that falls short of a<p>
then use a<div>
or<span>
depending, something that would not imply that what is being wrapped is something it is _not_.To reiterate, the semantic value of a line break is that it is a break – whatever the context may be – it does not _have_ to be a poem or address, though those are sensible uses for the tag as it were.
There really is no ambiguity about as much as I used to think there was.
Joe Dolson
A recent conversation on the GAWDS discussion list brought up a number of interesting points on the break tag, which I thought I’d append here as a comment.
First, some of my own:
Also, Matthew Smith discussed how he feels that the
<br />
is a semantic element: (in reference to an address)And in general:
Others made their own points, but these particularly stood out for me.
Joe Dolson
@Alfred – I like the way you think! Interesting to imagine a line break as a form of punctuation – a short pause; a breath.
@Karl – Microformats aren’t a bad way to go either. I just prefer a sparser code – unless I have a particular reason to employ microformats, I’m inclined to go for a method which minimizes the amount of code needed (both HTML (HyperText Markup Language) and CSS (Cascading Style Sheets).)
Karl
Hi Joe,
Interesting you mention addresses as the example there. I mark them up using Microformats now so whether you wrap the whole lot in an
address
tag or not, you have sufficient CSS (Cascading Style Sheets) hooks to set each span asdisplay:block;
. Semantic with nobr
debate 🙂Regards, Karl
Alfred Armstrong
Line breaks are semantic in poetry. Also sometimes advertising copy has a rhythm to it that demands breaks in particular places. A line break is a form of punctuation, a sort of semi-paragraph.