Article 6GZ5W CodeSOD: A Nice Break

CodeSOD: A Nice Break

by
Remy Porter
from The Daily WTF on (#6GZ5W)

Once upon a time, HTML had tags like <marquee>, which scrolled text across your page, and when combined with animated GIF backgrounds basically defined the Geocities aesthetic.

Since then, the HTML specification has been refined, and the choice has been made that HTML tags should (mostly) be about semantics- describing the structure of a page, the meaning of elements, and the relationship between those elements. It generally shouldn't describe the presentation of those elements (CSS should do that)- even though the semantics generally imply something about the display (paragraphs and divisions are block elements, for example).

And then <br> walks up and throws a wrench in that, because it's much more about the layout of a page than the semantic relationship between elements.

The <hr> tag falls into a similar space- it does represent a logical break between parts of the page, but also has a clear visual intent: draw a line on the page.

I'm not trying to suggest that either of those tags are wrong or shouldn't be part of the spec, I'm just highlighting that they're not precisely semantic- they don't have a pure semantic meaning like a paragraph or a logical division might.

But you know what is wrong? This HTML Ted found, which is a different way of getting a horizontal rule on the page.

<p style="color:#COCOCO">____________________________________________________</p></br>

Bonus points for the inline style, and the completely wrong use of </br>, which in HTML doesn't have a closing tag, and in XHTML can't contain content- perhaps they meant <br />.

And yes, you already know this, but this line is copy/pasted everywhere they want a horizontal rule on the page. Well, usually copied and pasted- a few of them have different numbers of "_" characters in them.

buildmaster-icon.png [Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments