Line25

10 HTML Tag Crimes You Really Shouldn’t Commit

Read the full post

You better watch out, because the HTML police are about. They scour your code and pick out the most unspeakable crimes against HTML markup. This handy list of ten HTML tag crimes sheds some light on some of the most common coding mistakes and helps provide an alternate solution. Tips include writing valid markup, making semantic choices, avoiding deprecated tags and more!

Crime 1: Placing Block Elements Inside Inline Elements

HTML elements can either be displayed in two ways, Block or Inline. Each tag by default is naturally either a block or inline element. Block elements include divs and paragraphs, that make up the structure of the document. Inline elements on the other hand should sit inside block elements and go with the flow of the document, examples include anchors and span tags. With this in mind, inline elements should always go inside block elements, and never the other way around.

Crime 2: Not Including an ALT Attribute on Images

The ALT attribute is a required element on all images displayed on a web page. It helps users determine what the image is, should they be browsing on a screen reader, or simply on a slow connection. The ALT attribute should describe the image being shown, so an alt=”image” is bad practice. If the image is purely for decorative purposes, simply add an empty alt attribute, such as alt=”".

Crime 3: Not Using Lists When Necessary

The handy UL (and OL) tags have a bunch of uses and are extremely versatile for the display of all kinds of page items. Unsurprisingly the Unordered List tag does a great job of displaying a list of information, so don’t even think about using a bunch of line breaks ever again!

Crime 4: Using <b> and <i> for Bolding and Italicizing

The <b> and <i> tags make the text appear bold and italic respectively, but semantically they are classed as presentational tags, therefore the effect would be best replicated with the CSS styles of font-weight and font-style. If the passage of text suggests areas of importance, they should be highlighted with the <strong> or <em> tags, which basically do the same job as <b> and <i>, but also make the world a nicer place.

Crime 5: Using Too Many Line Breaks

The line break tag of <br /> should only be used to insert is single line breaks in the flow of paragraph text to knock a particularly word down onto a new line. It shouldn’t be used to make gaps between elements, instead, split the text into separate paragraphs, or adjust the margin styled by CSS.

Crime 6: Using The Wrong Strikethrough Tags

In the olden days, <s> and <strike> were around to allow edits and amends to web text. However they are now classed as deprecated tags, which means they still work fine (in Transitional), but there’s a set of new tags on the block – <del> and <ins>. These new tags are used together to show deleted, and the subsequently inserted text in a document.

Crime 7: Using Inline Styling

You’ve heard it a thousand times – Inline styling is bad. The whole point of semantic HTML and CSS is to separate document structure and styling, so it just doesn’t make sense to go placing styling directly in the HTML document. Remember to always keep your styles in your stylesheet where they belong.

Crime 8: Adding or Removing Borders in HTML

The border attribute is another presentational effect, so semantically it should be left to the CSS, even if it’s removing a default border from an element.

Crime 9: Not Using Header Tags

Header tags are available all the way from <h1> to <h6>, and make handy tags to separate your document into titled sections. If you have a selection of words indicating what content is due to appear next, chances are one of the header tags will fit right in. Your choice of header tag depends on the flow of your document, try to naturally insert them in order of 1-6 where appropriate.

Crime 10: The Unspeakable Use of <blink> or <marquee>

Apart from not even being part of the official collection of standard HTML endorsed by the W3 Consortium, the <blink> and <marquee> tags are just pure ugliness. If there’s something you need to draw attention to, I’m sure you can think of plenty of alternate ways to draw focus to that area of the page than to have it flash on and off or scroll across the page!

Free web shadows pack for every subscriber

Join the mailing list to have new content delivered straight to your email inbox. Every subscriber gets a free pack of realistic web shadows.

Written by Chris Spooner

Chris Spooner is a designer who loves experimenting with new web design techniques collating creative website designs. Check out Chris' design tutorials and articles at Blog.SpoonGraphics or follow his daily findings on Twitter.

302 Comments

  1. Great article, I completely agree with everything you just said, I just need to learn to put it into practise myself!

    • Juanita says:

      Yes. I would need to have a personal assistant to do everything else in my life that I would no longer be able to do because I have to update all my code. I agree these are best practices but they are hard to implement retroactive on an established blog. I am slowly chugging along making these changes.

    • 9swords says:

      Echo that, consider me a repeat offender :)
      I commit some of these coding crimes as i design pages then i go over the code afterward to remove them.

  2. P.S. Keep writing articles like this, they’re really helpful!

  3. Marco says:

    Damn you Chris – I was written an article pretty similar to this one ;) . Will have to trash it now, otherwise you’ll sue me as a copycat.

    Still, very much enjoyed reading this article! Great/cute code examples.

    Also, don’t forget this crime:

    I want to have some space between some sentences       So I’ll do this!

  4. Great Blog, I put all this into practice myself anyway. I was not aware of the strikethrough tags so thanks for that!

  5. Alin Ivana says:

    Keep it up you guys, your posts rock! digging and retweeting is fun :D

  6. Glyn Jackson says:

    I think your bang on with everything other than the ‘b’ tag . The ‘strong’ tag is used when you want to add emphasis to particular words or phrase, but some screen readers may use a different inflection when they come across these tags to communicate the emphasis. if your aim is to make a work bold always use ‘b’ tag never ‘strong’ b’ tag works in almost very browser known!

    what to read more on this: http://www.think-ink.net/html/bold.htm

    • On the other hand the ‘b’ tag is presentational, therefore semantically, should be left to the CSS.

      Plus, if something on the page that is being made bold, it would suggest that it’s an element that need emphasis – so here’s when the strong tag comes into play. If not, then chances are a simple span would fit better.

      I get your point though, during my research I read about screenreaders interpreting ‘b’ and ‘strong’ differently. But overall, if the BBC don’t use ‘b’, that’s good enough for me :-)

    • ‘b’ means ‘bold’. ‘em’ means ‘emphasis’. ‘strong’ means even more emphasis. ‘b’ is presentational, ‘em’ & ‘strong’ are semantic. Period.

    • Dylan Parry says:

      I’d have to agree, in some way, with this. If you sole intention is to create bold text, without any other real meaning, then the “b” element might be the way to go—though a “span” with a class might be another solution.

      There are cases where you might want to use the “i” element too. For example, in Latin names of animals/plants you should italicise part of the name (the species bit) and to use the “em” element would be semantically incorrect. You could use an “i” element with a class of “species” for example, which would give semantic meaning to the element.

      All that said, cases where those two elements can correctly be used are few and far between, so it’s unlikely that you’ll ever need to use them.

      • Foamcow says:

        On the other hand, if your sole intention is to make some text heavier without adding emphasis then the “correct” tag would be a .

        You would then apply a visual style via CSS to that span (via a class or hierarchy).

  7. Sankar says:

    Hey Chris,

    These are the simple and common mistakes that everyone done in html. Nice article, information organized well.

    Thanks
    Sankar

  8. Adam says:

    I take it your abit of a thundercats fan? :) It’s like a LSD trip :D

    Cannot belive anyone would use blink anymore haha.

  9. Farooq says:

    really nice and important crime report for HTML tags, but people are use to commit these crimes in there projects.

  10. Swerve says:

    Good post. We should should start a ‘Cruelty against HTML elements’ foundation? They can monitor, and punish offenders :-)

  11. theodin says:

    wicked article, I didn’t even realize about the deprecated tags, thanks!

  12. Toby says:

    Lolled at Crime 10

  13. saurabh shah says:

    nice post chris … …

  14. Elliot says:

    don’t ever, ever, ever look at the code for html email..

  15. Meera Tank says:

    Great article, very simple tips there, yet so many people trip over on these.

  16. Marc Ashwell says:

    the funny thing is that the font attribute is so old, it doesnt feature. you could get your hand copped off now for using it.

  17. Great article. I usually stay away from these 10 crimes. I do find myself forgetting the alt tag sometimes though.

  18. For few outdated browsers, you still have to put border=”0″ on images, because border:0px; doesn’t quite do the trick.

    • Brandon Florkey says:

      What outdated browsers are you referring to? We design for IE6 at my work, unfortunately. I use border:none; in the css and it takes off border’s on linked images just fine.

  19. grazz says:

    I would also call non indenting HTML code a crime. Not a major one, but still…

  20. Matt Ward says:

    Great post! Especially love the hate toward the marquee tag. I actually have a new client that just came to me, and his website currently uses it. Worst part is he thought it looked cool. At least he avoided the blink tag.

  21. Sid says:

    Panthro is blatantly the best Thundercat! Oh, great post too!!!

  22. Adam says:

    It’s a shame that some large email clients (inc Outlook, Gmail) don’t agree with Crime 7.
    They seem to ignore most HEAD content, inline styles seems the only compromise.
    Thunder… Thunder…. aaaaaarrgh!!

    • Foamcow says:

      I kind of agree, but they are “email clients” and not “web browsers”.

      An email client’s rendering of HTML is an added extra rather than its main purpose.

  23. normalfx says:

    Thanks Chris. I’ll always keep it in my mind.

  24. Dan Wellman says:

    Number 11. using inline event handlers ;)

    onclick=”killmenow()”

    urgh!

    great article

  25. Patrik says:

    Well, you say that you should use alt on images, but you don’t :)

  26. Alex says:

    Thanks for this post! :-) I make one of those mistakes but I’ll never do it again after I’ve read it here. :-) Your post is a great reminder!

    Keep it up!

  27. Teddy says:

    I guess one of the most prominent problems is designers and coders alike unintentionally wrapping a block element in an inline element – and the most prevalent examples are wrapping a block element with <a> … </a> tags. Although the codes are still rendered properly in most browsers, further perpetuating the wrong information that it’s okay to do so (eg – making whole link blocks clickable by wrapping them in <a> … </a>), there are valid ways to go about doing so.

    I second the very last crime – I’ve seen just too much of it. They make me all woozy, especially blink.

  28. Looks like the HTML Police won’t be after me then?

    :)

  29. Chris Kemp says:

    You’re right, of course. But of all of them, I’ll cop to using when I’m in a hurry. We can’t all be perfect all the time.

  30. Ash says:

    I struggle with the in-line styles. I’m concious of having large stylesheets shared across all pages, and just a little bit too dis-organised to split them in multiple files.

    One-off styles often end up in-line. But you’re right, that should stop…..

  31. Moschos says:

    Excellent!! Keep informing us :)

  32. PufferMedia says:

    This is a great list, and I certainly wouldn’t argue any of these points. It’s great to be reminded of them.

    But, yeah, let’s be honest, when dealing with large CMS sites with frequently updated content, inline styles/css can be a useful tool/cheat. I’m not talking about your average wordpress blog, but multi-tiered sites with complex css structures controlling various elements. Not all of us have the support staff to have someone comb submitted content to make sure it is semantically pure.

    I think the most realistic thing we can do as developers/designers is build a semantically sound foundation that is able to support a certain degree of html slop from authors. And sometimes, indeed, you just need to style something quick.

    Now I’m off to look at cleaning up a few sites. ;-)

  33. Siimples e direto!

  34. I would’ve thought most of these would be common sense. Crime 5 needs an explanation, whats wrong with extra tags? Well it’s like faking a new paragraph. Looks fine and causes no problems for sighted users but for screen reader users their software doesn’t know to “draw breath”.

  35. Rick says:

    That’s true, but have more crimes in the htmls tags in a webpage. Good article.

  36. My knowledge of CSS is not brilliant, subsequently, things like doing borders in the style sheet generally leads to utter disaster and so I revert back to html to get the job done and move on (as well as saving my sanity)

    Thanks for the reminder

  37. Dudikof says:

    #4 is bullshit, the rest is good.

    • Stuart W says:

      Yes, the crime is using strong and em for all bold and italicized text, whether emphasized or not

  38. HTMLsince1994 says:

    1. Who gives a fuck about strong versus b. What the hell is the different? Use styles in the css if anything. If you’re going to use tags in the html…who fucking cares which?

    2. Who cares which strike through tag you use! You apparently are one of these blokes that insists on always using the latest and newest shit. I’d say older stuff is better if, like with all these tags, they all do the same fucking thing. The older ones are more likely to work because who doesn’t know of them? The newer ones have a higher chance of not working since some people may not have bought into them yet.

    3. Sometimes using a styleinside a tag is necessary to take maximum precedence. It’s rare – but it’s made possible for a reason.

    4. All these 10 “rules” are just opinions for people who buy into the strict methods and who think their farts don’t stick. Most of them actually don’t make a difference. The day they throw syntax errors is the day I’ll fully abide by them. Until then, I’ll take strict rules with C++ and Perl, but not HTML. This is all just OPINION.

    • Teddy says:

      Before you want to get heard, learn how to respect differences.

      It’s okay that you live in the old era of Internet coding, but don’t stop others from moving on.

  39. Eric Eggert says:

    Learn the difference between tags and elements.

    • SomeOldDude says:

      STFU, Eric. Some people call all html tags tags, even when they’re elements or when they’re just things that manipulate elements. If they’re inside so a lot of people they’re tags. Whoopie fucking doo.

  40. Ege says:

    Leave “blink” alone! =p

    good list, btw

  41. PAULE says:

    You´re right Dudikof.
    They have complete different meanings.

  42. Jarod says:

    haha love the the Thundercats usage

  43. The list of tag crimes is very apt and many people including myself fall into it. The next time when dealing with html I’ll be mindful of the 10 tag crimes.

  44. Stephane says:

    From what I understand, crime 1 and 4 are allowed in HTML 5, and are there to mark stuff like company name that are not more meaningfull so they don’t require a of .

    Yes I know, another set of new rules again.

  45. Stephane says:

    Oups,

    From what I understand, crime 1 and 4 are allowed in HTML 5,«b» and «i» are there to mark stuff like company name that are not more meaningfull so they don’t require a «strong» of «em».
    Yes I know, another set of new rules again.

  46. A very interesting post… do keep them coming…

  47. macoteca says:

    Great post. The inline Vs Block elements is one of the most commond mistakes I see and the explanation was great.

  48. Alex says:

    Great article. Bonus points for having nearly all the examples use Thundercats.

    HOOOOOOOOOOOOO!

  49. Learned about strikethrough tag. Great post!

  50. Jonas says:

    Very good, thank’s :P

  51. Iva says:

    WHO on Earth even remembers the blink tag? That IS traumatising.

    I never used ins tag before, so I did learn something new here.

  52. Jeremy says:

    This is great, thank you.

  53. George says:

    It would be good if you gave some specific reasons for not doing these things beyond simply saying “don’t do that, do this instead”.
    How would you handle a situation where you want to make an entire block of information clickable with a link to a detail page? For example, if you have a list of people with some basic information displaying for each, and you want to be able to click anywhere on that person’s “Block” to be directed to their entire bio.

  54. AndrewGene says:

    What would you do in order to simulate the tag? I have only used it once but it did the job nicely. Anything I can do instead without resorting to javascript?

    • AndrewGene says:

      that’s supposed to be “marquee” tag…the commenting system took out the “”

  55. Fred Alger says:

    It’s almost embarrassing to admit that I won an award for a site made with blink and marquee tags. In my defense, it was the first site I ever built, and was pretty hot stuff for 1995.

    I wonder about using align=”" on an img tag. It seems like it’d be better to put that in the stylesheet as a float, right?

  56. Matt says:

    I am loving this list, I am sure almost every one who has worked with HTML has made at least one of these mistakes at one point in their career.

    Excellent list!

  57. Dori says:

    I think it’s important to note for beginners that there are times when it’s OK to break the “no inline styles” rule. There IS a time and place for them.

    For instance, let’s say I want my H2 tag to be a different color on each of the 20 pages of my website. Is it better to use an inline style for each one, or add 20 more lines to my stylesheet that have to be loaded for every page hit on my site? Sure, twenty lines isn’t bad but when you have a complicated website that’s NOT based on a cookie cutter template, that number can grow fast! There’s no good reason to bloat your external CSS with numerous styles that are only used once, other than trying to be technically correct.

    Other than that, I must say your article is very nicely written. Thanks.

    • Dana says:

      At that point, I believe you would use styles in the head with the appropriate classes/ids or just targeting the standard tags. I’m hard pressed to think of a reason inline styles would have to be used when I’m not just feeling lazy and don’t want to do it right. :P I’ve done it before.

    • Brandon says:

      I have to agree with Dana, the only time I’ve used inline styles is when I’m feeling lazy. Sometimes, yes, you may want to target classes/id’s specifically on that page, but it would be better to make a specific stylesheet for this, or as Dana mentioned, add it to the head of the document, and not within each particular element. I think most people have done it before, myself included, but it makes for messy code.

      • Dana says:

        Most secondary pages get the styles in the head. The index page almost always needs it’s own stylesheet. Multiple stylesheets helps clean things up, for sure!

    • JR says:

      I agree with Dana also, but there is one specific instance where inline styles are appropriate: dynamically generated divs that are being affected by jquery’s (for example) animation functions. Sometimes a div needs display: none to begin with, and doing that with a class doesn’t always work.

      • Dana says:

        And, further down, the comments, someone mentioned CMS issues. That’s also true. So, we have specific JavaScript declarations and CMS workarounds. :)

        • I love breaking the rules. Oh, I’m so cool. I smoke too.

          Really, though.. I’m kind of tired of seeing how Semantics can create cults in coding. So, this is how religions get perversed and forget their purpose. I’m glad to bear witness.

  58. Tom says:

    Didn’t know about the strike one, the rest seam simple enough to follow.

  59. Ozh says:

    Yeah, never commit these crimes, because they are deprecated manners and they, errr, like, humm, render totally OK in all browsers.

  60. Thierry says:

    I find inline styles to be a necessary evil when dealing with CMS-generated elements (such as adding a CMS image as an element’s background.)

  61. designiac says:

    straight to the point!

    I’d like to add:

    Don’t use -tags
    Use instead ,

  62. designiac says:

    oh, my html-tags disappear in my last post!

    Don’t use center-tags
    I recommend to use align=center in p-tags, div-tags…

  63. Will says:

    Thanks for the info. I probably have some mistakes in my site that need to be taken care of. Good advice!

  64. Thanks for sharing this list, Chris – and particularly for writing it in such a way as to give me a good chuckle at the end of the day. :)

  65. Brad says:

    SNARF SNARF

  66. Placehold says:

    Well written Chris, Very nice,

    Also most of this (If you are a good programmer/designer/developer) would come naturally however laziness plays a huge factor in it.

    Thanks for making me smile today lol :)

    Regards

    Craig
    Thanks for the

  67. sergi says:

    i’ve been developing for years, but still learned a couple things from this list, in particular about “no multiple ‘s” and the use of and .

    thanks for the article, dude.

  68. John Cartago says:

    I sometimes do the inline styling when I get lazy haha :)

  69. Em says:

    I often find that people use just to style text with a strikethough rather than using {text-decoration: line-through;}.

  70. Em says:

    Let’s try that again. Ahem.

    I often find that people use the del tag just to style text with a strikethough rather than using {text-decoration: line-through;}.

    • Stuart W says:

      As they should in most cases

      • Nox says:

        No, they shouldn’t. The del tag has a specific semantic meaning, separate from how it looks. If people are using del just to give their text a decorative line-though, they are DOIN’ IT WRONG, as the kids say.

  71. Josh says:

    Crime 11: Not making abundantly clear what happens to HTML markup that users enter in a comment form.

    • Ahruman says:

      So very, very true. What use is semantically pure piece of HTML that renders as a site with poor usability?

  72. Rafael says:

    Well I don’t kow some things out there just make sense but also means a hell of extra work in the end.

    I mean, if a simple “i” will do the italic job, why should I type lots of extra characters and extra files (the css sheet)?

    Well, except when talking about deprecated tags, many of this “rules” just seem pointless and dictatorial to me. I mean, who said I can’t use five BR tags if I want to jump five lines? won’t it work fine in any browser? yes it will. isn’t the BR tag out there to be used? yes it is. So… I really don’t get the atual point of some of this rules some people put as “crimes”. BR are crimes now heh? Oh c’mon!

    I go for the easiest, specially if it means the same result at all.

    And what about the first tip: what if I want the whole block element to work as a hyperlink, and not just the text inside it? in this case I have to place the “a” tag outside the “div”, cause I want all the div to be a link (without java’s onclicks either).

    • Jason says:

      I’m going to make the assumption based on your post that you also use tables for layout. Web standards are like a toolbox full of tools. Your approach is essentially choosing to use the hammer to make a hole. Will it work? Sure. However, any professional will tell you that a drill is the right tool for that job.

      If you think using a style sheet is extra work and the “i” tag isn’t deprecated then I am curious where you have been for the last, I don’t know, 10 years or so?

      • Stuart W says:

        The “i” tag isn’t deprecated

        • kevinMario says:

          I’ve to agree with Rafael with his BR and block A tag – although the later is really rarely used since you will end up with a clickable white space if you don’t set it up properly.

          But yeah, the BR point is silly.

  73. Jason says:

    I agree and most of those would be easily caught if you take the time to validate your code.

    I would also like to add a couple pet peeves like:

    Don’t use a bunch non-breaking spaces, apply some padding with CSS instead.

    Use a definition list instead of an unordered list if one is called for.

    And for God’s sake, use comments – that’s what they’re there for. A simple comment to say what div you’re closing can save you a ton of time and headache.

  74. Whazor says:

    Maybe if you use some CSS for the blink tags, it would be useful for highlighting things.

  75. Leo says:

    Very nice breakdown of common errors I usually see.
    Learned the DEL and INS tags myself.

    thanks!

  76. Jack Frost says:

    If it shows up correctly on the 2-3 major browsers, who cares? Customers aren’t looking through my code saying, “Gee, I really wanted to buy a scooter from this site, but… they’ve got a {B} tag in the code. I’ll just buy from someplace else!”

    lmao.

  77. kL says:

    But {B} and {I} elements *are* the most semantic elements for bolding and italicizing!

    Maybe you’ve meant emphasis and strong emphasis? But these are not synonymous with bold and italic. Speaking of them as bold/italic is like “use h1 for big text!”.

    • I completely agree.

      If you want a piece of text to be bold or italic, use the B or I tags. If you want to (strongly) emphasise a piece of text, use EM or STRONG. Don’t use EM to make your text italic or STRONG to make text bold.

  78. Dave says:

    @kL bold and italic are only semantic for visual presentation – they hold no meaning for a screen-reader. How do you interpret “bold” if you are reading it allowed to some one else for example?

    Remember the whole point for the revised markup was to make the documents structure independent of presentation and B/I tags do not allow that as they inherently refer to presentation and not to the meaning of the document.

    • Graham says:

      Meah. I used to preach this stuff back a few years ago, but find myself caring less and less these days. Please don’t tell me that a screen reader really sees more value in ‘strong’ than ‘b’ tags. And if so, its the GD fault of the screen reader.

      And in-line styles are kind of necessary when you enter JavaScript development. Plus, if you truly need the style only once, then it seems easier to me to maintain if it’s right there in the markup. This coming from a guy who used to quote the whole “separation of markup and presentation” thing all the time.

      Which, btw, I have yet to see ANY real benefit from. Honestly, if you use a stylesheet for every single style rule on your page, it will become a bloated mess over time, with 1000 entries.

  79. erne says:

    i strongly recommend using
    text-decoration: blink;
    instead of

    ;)

  80. amrelgarhy says:

    Nice article, nice explanation, nice examples and nice blog :).

  81. Great list. I can’t imagine anyone still using blink. That has to be the worst crime of them all.

  82. honour chick says:

    great advice w/ emphasis on “blink”. very useless declaration. ;)

  83. Jeremy says:

    I’m ashamed to admit I’ve done all of this at one time or another. I also admit I love using blink to annoy my co-workers!

  84. Dennis says:

    These items are very basic, but unfortunately, very necessary! Great article.

  85. jerry black says:

    … gonna start using the blink tag now!

  86. devolved says:

    I am innocence2 ;)

  87. Sherry says:

    1) Thanks! Great things to remember… tho, thankfully, I’ve only been guilty of 2 on this list… will work to avoid those. :)

    2) Thanks for referencing Thundercats. That totally rocks my day. :D

  88. BD says:

    While I would advocate doing it with CSS, there are certain very limited areas where blinking text is not only useful, but also can prevent end lusers from getting themselves into hot water.

    Don’t get me wrong, I’ve used blink exactly twice in my life, but for all things there is a time.

    Better rule would be “Don’t use blink just to use it. If the world would keep on spinning without the extra extreme emphasis that it imparts, you probably don’t need it.”

  89. Norman says:

    I probably made all the mistakes on the list (except blink of course) at least once during my rather short web career.
    But as I got more experienced with web standards by now, I totally agree with every point on the list. Its not like we have to code that way but “code is poetry” and I’d rather like to code nice stuff. Not to please others or customers but to please my conscience ;)

    good list!

  90. Tom Duong says:

    Thanks for this informative post. I think it’s about time to clean up some of my HTML tags.

  91. Tomas says:

    I disagree with people that want to split up everything endless much. You can’t found things at one place, you need to go to a chain of references/functions/whatever to get the big picture. Why not making something global when it need to be shared and not everytime? Use the tags that suit your needs, you are not going to be punished, but its good to think one step ahead and being aware of the risks. Read, test, expriment and make your own opinions, its not written in stone.

  92. Some good tips, not sure about the multi one

  93. I didn’t realise the first one until I validated my code using the strict Doctype. Yay for validation! If you get the web developers toolbar and validate your XHTML, CSS and accessibility there’s less chance you’ll be committing those HTML tag crimes!

  94. Luis says:

    Thanks for the tips, bookmarked. I’ll quote you in a future post of mine.

  95. aharen says:

    Great Article, some of these mistakes i have made myself, but its never too late to start correcting your mistakes right! :)

    cheers

  96. Awesome article, Thanks Chris. Im definitly showing this to my Web Design students!

  97. engin says:

    Blink is cool!

  98. Marcel says:

    I think you could have done better.
    I would say that this is a beginner’s article. No one does mistakes like does after a couple of years of experience.

    Thanks,
    Marcel

  99. Andris says:

    These are the basics! Thanx for the summary. But shouldn’t it say “Headings” instead of “Headers” in no. 9?

  100. How do you handle inline images in a way that a feedreader will properly display the image? Using classes and CSS with float:left/right will make the result look quite ugly in a feedreader, inline styles work better in that case. Any suggestions?

    • Hi Jörn says:

      Don’t use float if it will render ugly, instead use classes with rules defining positioning, padding, and margins for a left justified or right justified image.

  101. bowo says:

    keren bozz
    reti bahasa jawa rak kuwe??
    hehehe

  102. CMS Themes says:

    Nice article mate. I followed almost all of your tips already.

  103. WebUnicorn says:

    very basic but very important

  104. Great looking post. Clean, simple, easy to read. Good job. And Snarf is the coolest Thundercat not Panthro. :)

  105. dano manion says:

    I miss I was hoping for a comeback with variations, such as, blink-time: 2 secs or what about blink-style: rainbow? :-(
    Great post, thank you.

  106. kieran says:

    thanks! nice and clean!

  107. Chris says:

    Good work.. Thank you for this article

  108. Kevin says:

    Snarf is definitely not the coolest Thundercat.

  109. Tyler Diaz says:

    Nice round up, but I always have found the strong over bold tag ridiculous. The purpose of the bold tag is to bold the text, and it seems to be complying perfectly with its function.

    I respect web standards, but sometimes they can go to extremes that honestly make very little sense.

  110. bebopdesigner says:

    Thanks for posting!

  111. workmad3 says:

    Nice to know these :)

    Admittedly I do some of them (such as the occasional inline styling) but I know I’m doing wrong and feel dirty, but it’s so much quicker for a simple hack :)

  112. Ken says:

    I disagree with the point on inline styles. Inline styles are just find as long as you don’t abuse them. If you have a corner case here and there, inline styles are a lot cleaner than an overly bloated CSS file.

  113. Christian Mejia says:

    I am so guilty of a lot of these crimes!!! But I guess that’s what happens when you are self-taught. In the last couple of years I have managed to get away from a lot of these crimes but I’m glad you posted this because now I can be more aware of my faults. Thanks for the reminder.

    BTW… Kudos on the Thundercat shout outs. That cartoon brings back great childhood memories.

  114. unitechy says:

    I used to do all those when i first started out :D

  115. WebDev says:

    Wow! Great collection of teaching instructions :)

  116. Diego Ripley says:

    I’m am no longer guilty of crime #9.

  117. Alex says:

    the only one i struggle with occasionally is number 1 – sometimes its cool to have a whole div be a link (and not just the text inside it). anyway around that? How naughty is it anyway?

  118. comsharp says:

    inline style is really handy if there are used only once in somewhere of your document.

    put trivial styles all in external css file some times doesn’t make sense.

  119. Brussells says:

    Wicked article! especially for a someone like me who’s in the learning stage of webdesign and wishes to do things right from the start, as opposed to getting into bad habits (that’ll come later no doubt).
    Thanks.

  120. xxgoblin says:

    =) thanx, interesting

  121. Gee says:

    Chris, you made 10 crimes in your article. Where are alt attributes on images? :)

  122. Jeff Starr says:

    Second Ozh on b/strong elements’ SEO usefulness. Also second Ken on usefulness of inline styles. And thanks for the reminder on del/ins over strike (guilty as charged).

  123. mikemike says:

    @Ozh

    Wrong, it’s never appropriate to anything for the sake of SEO, not to mention that a header tag (ie, ) holds more weight than a tag does (semantically speaking).

  124. mikemike says:

    HAHAHA!

  125. chris says:

    I second Ozh, Was just about to mention that but you beat me to it

    Strong tags can help with page weight.

  126. Franco says:

    Thanks for remembering some sins we shouldn’t commit, especially the “alt” tag if we think more of visually impaired web site surfers.

  127. div says:

    very useful info. thanks.

  128. div says:

    very useful info.

  129. Soggy says:

    Alt tags should be empty unless the image contains information related to the text. That is, if the image is just some bling for the page and you add alt text your just spamming the poor visually impaired guy with useless noise. how often do you in a conversation stop and say ‘panthro from the thundercats’ then continue talking ?

  130. Naeem says:

    Amazing Article!

  131. Bowenkämper says:

    Beware of the SEO do’s and don’t!
    Good style is always appreciated.

    Many good point. Thanks.

  132. Bowenkämper says:

    Beware of SEO do’s and don’ts. Good style is always appreciated.

    You mention a lot of good points!

  133. bonfield says:

    nice post.

    imho, a counter-crime on the b and i tags is overuse of strong and em. b and i are often actually the correct tags for bold and italic when the content is semantically bold or italic. i.e., a book title or a ship’s name that takes italic should actually get the i tag (since you’re not really emphasizing that bit, but italicizing it).

  134. Major props for showing love to the Thundercats… If you use GoBots in your next post, I’ll be a fan for life.

  135. Brad Gillap says:

    Great post Chris.I still have some of these terribly poor habits. I think most of it comes from us older guys that learned html before CSS even existed.

    Separating semantics from design using CSS is going to be more important than ever in the next few years.

    You should write a post on Microformats next and why they becoming more important every day.

  136. BenSpark says:

    An Excellent list and the Thundercats touch was great, although Transformers would have been better. :-) I’m adding this blog to my feed reader and going to fix my tags. I’m still working off my knowledge from 1996.

  137. Sun says:

    Much Apreciated! and memorized! Thanks for the tips!

  138. Jack says:

    Fussy or what!

  139. Sathish says:

    Wow!! Its amazing. I’m not committing any of the crimes, may be just missing alt attributes for images sometimes. but, will fix that in page validation process.

  140. neuz8 says:

    Do you really think that a “strong”a-tag is more important than a CSS-Strong-a-tag?

    A Link is not more or less than a Link, a Bold Link ist only a Style, if you have a Linklist with many Links then “strong” is the way to style the one more important Link Bold. If you have only strong Links – CSS is the better way.

  141. The YPI says:

    Thanks interesting

  142. hehe says:

    Simply love this article. Excellent work.

  143. Iridium says:

    I can only agree completely on #1 and #10, but I also use tables for layout occasionally, so maybe you should put me in jail ;-)

  144. Lee Dumond says:

    Another thing you should have mentioned about header tags is not to skip levels. In other words, don’t do this:

    <h1>Lions</h1>
    <h3>Tigerss</h3>
    <h5>Bears</h5>

    Instead:

    <h1>Lions</h1>
    <h2>Tigerss</h2>
    <h3>Bears</h3>

  145. Disagree (slightly) with and tags. They are *not* the same as and . For example, is used for emphasis, and the formatting is dependent upon CSS. Italics, on the other hand, are mandated for the titles of books, and have a different semantic meaning than emphasis. For example, the CSS may designate as using a bold face, but book titles still need to be in italics.

  146. oh yes, absolutely correct. it’s really sad that most of us don’t really bother about these html tags but these are really important from SEO point of view as well.

    nice article. please write some more of articles focusing seo.

    thanks

  147. adrmx says:

    Hi. Can I translate this post to Spanish? and publish it in my blog. Obviously with your credits.

  148. antonio says:

    so old…

  149. Smackitta says:

    coooool, i learned a lot, many thanks

  150. dpi says:

    Important and very basic points. Very useful article.

  151. Mario says:

    me liek thunderkatz

  152. syikin says:

    great! i didn’t realise about the strikethrough new codes.

  153. Great advice. I practice some of these techniques but I need to go back and check that I am doing some of the others. Very good post.

  154. LimeOrange says:

    Good stuff, but what’s with the cartoon crap?

  155. Kim H says:

    Ahaha! What a great and memorable post!

    Definitely a great tool for the beginning designer :)

  156. arpit says:

    Great Job

  157. JeraJdai says:

    Your article needs some fact checking. The coolest Thundercat is Cheetara.

  158. I’ve written a tutorial for an art Ning site, and had to space down from a photo. I hate to say it: I used the line break umpteen times to get the photos positioned where I wanted them. I am totally unused to html – what code should I have used instead?

  159. TBS says:

    Forget the title attribute in hyperlinks is also unforgivable

  160. Gerasimos says:

    Excellent article. Shall we add to the list the naming conventions of sections like which i must admit it’s a personal thing but why not use names that make sense like ?

  161. Sharon says:

    Glad to see I’m not a super-criminal. The only one I didn’t know about was the & but I’ve never really had occasion to use them anyways.
    The only time I use inline styling if there’s just the one bit on a single page that needs to be different. Do I need a lawyer? :-)

  162. Do Jacobson says:

    Nice article!
    There is only one place where inline CSS is unavoidable, and those are HTML-newsletters. Most e-mailclients don’t support external CSS and will strip any CSS that is placed in the header or body.

  163. murrydan says:

    I find myself correcting crime #1 at times, nice to have an article that calls it a crime, makes it more urgent to change my behavior.

  164. Dan Kuck says:

    Cliff is right. The real crime is using {em} and {strong} when they aren’t appropriate.

    If we’re working toward a semantic web, we need to focus on using those tags correctly. The web is full of things like {em}The Grapes of Wrath{/em}. That can get very annoying to someone who uses a text-reader and has to hear book titles emphasized every time they are mentioned on a webpage.

    {em} and {strong} are usually lies. At least {i} and {b} give no information.

  165. disha says:

    itz good….i pleased to c ol comments and views.

  166. shadowMason says:

    nice… thank you. My students will like this. Well, maybe not… but I do.

  167. mergs says:

    awesome article

  168. Cliff definitely makes some good points. Agreed across the board. As far as using titles in {a} tags, never done it but perhaps I should start. Thanks for the roundup. I spend most of my time focusing on database programming, but it’s always refreshing to find ways to improve my markup.

  169. Mike says:

    Cliff is correct; your crime number four was badly demonstrated, as the bold text doesn’t appear to need any emphasis, and the text in STRONG tags appears to need two levels of emphasis.

    There are plenty of occasions where text, such as a book reference, need a particular format, and for those cases B and I are perfect, and perfectly acceptable.

  170. anapatrice says:

    I certainly learned a lot today…Was fond of doing all the bad things your wrote about….I need to break the habit, especially the thing. Thanks!

  171. Matt says:

    Good advice. The strikethrough code tip was new to me. I’m going to start using that right away.

  172. Kaplang says:

    some really useful info, thanks :)

  173. Azenquor says:

    Thanks a lot for the info…

  174. Lizzy says:

    Ok, good to know I’m a big criminal. :(

  175. Lisa says:

    I didn’t know about the strikethroughs — but — inline CSS – is there any other way to get gmail to recognize CSS? That’s the only time I use inline CSS.

  176. Aaron says:

    Good post but you might want to explain why a bit more for the newbies :)

  177. Aaron says:

    I wouldn’t use {del} and {ins}

  178. SunJoo says:

    Another great tips. Something I missed.

  179. yazılım says:

    Great post, did not know about strike tag

  180. Nice. I made the mistake of putting block tags into inline tags awhile back. Didn’t realize why the editor was complaining. Thanks for explaining that to me.

    Instead of using a bunch of tags, I use a div with inline styles for margin or padding. I’d have to write innumerable classes for each possible scenario.

    Thanks

  181. Michael says:

    Liked: Use of Thundercats

    Disliked: That you pretty much summed up the fact that some tags are deprecated for no reason at all, and there is 0 penalty for using them.

    Just goes to show how badly we need HTML5 to be semantically un-retarded.

  182. JETR NSEF says:

    Gud Work dude, weldone
    nice

  183. samma89 says:

    hmm……its gud to know about this.thnx dude.!

  184. Only one crime: “5 – “

  185. Hey,
    That is nice for me. I’m a software developer (hard core not gui). That is why that article helped me about css and html.Because I have been trying to design my website also I couldn’t.

    Thanks

  186. That is a nice perspective. I’m a software developer. (not gui) I have been trying to design my personal site also I could not :).

    I will check this rules on my personal site.

    Thanks.

  187. David says:

    Panthro was always my favorite.

    BTW — Nice list of crimes ;-)

  188. Ant says:

    In HTML5 it is allowed to wrap block element with «a» (at least it’s correct!).

    Also, if image is for decorative purpose, isn”t better to use css background instead?

  189. Richard says:

    re: #8, some rich text editors automatically assign border=0 to the img element – otherwise good!

  190. Michelle says:

    one of the best articles i have ever read on html, really good and very useful, thanks

  191. elena says:

    You are a total cutie.

    I guess the article was ok too. ;)

  192. No one knows everything says:

    I disagree with rule #10, and I’m not the only one. I’m not saying you should use the ‘marquee’ and ‘blink’ tags, but the effect, at least for ‘marquee’, could be useful for a short headline. So it really isn’t ugly, if done right. In fact the effect is to be added in to CSS3, so someone finds it useful, other than me.

  193. jase says:

    Instead of reading this post, you could just validate your site at w3c. It’ll tell you what you’re doing wrong

  194. syahzul says:

    great article. thank u very much.

  195. supercomputerfreakyzebra says:

    this, is just, wow, omggd, wow, my zebras all happy(: thannnkkkyouu, your bad sselff(:

  196. Milo says:

    I’m in favor of the semantic-only approach, in theory, but it’s clear that most people don’t understand that just because something is visual doesn’t make it non-semantic.

    The term “strong” is especially funny I think. Whoever had referred to strong text or described bold-set words as “strong” before the invention of this misguided element? There is no such thing as “strong” text. As for emphasis, well, should we have a sarcasm tag too, depending on the particular (semantic) meaning of the italics?

    If this is the point — to break down semantic typographic attributes into abstract meanings (perhaps in the name of accessibility), why don’t we have a span around each and every word with a “dictionaryid” attribute indicating its specific meaning (assuming the meaning has been registered by some bureau of language standards — otherwise, should you really be using a non-standard word? It might not validate).

    Do whatever works unless there’s actually a reason not to. Consecutive line-breaks? There may be a more efficient way to do that (unless you only need the gap once), but it’s not like there’s any browser that won’t understand the br tag… I don’t like this dogmatic approach at all.

  197. Hasan says:

    Inline styling (Crime 7) is not a crim!! Many famous giants like google, yahoo, w3.org use it & recommends them.
    They come in handy when you do not wanna load a new stylesheet file for just few new lines of styling, Instead you can use inline style tag to achieve performance.

  198. Tom says:

    I take most of these for granted but the online styling doesn’t sit very well with me. Obviously it’s best to put everything into CSS but sometimes it’s actually more convenient to add a width to an id/class-less div than to give that div an arbitrary id or class that will be hard to track down later – should I need to ammend it. What I am considering is a more modularised approach entirely:

    name and define classes iny CSS for widths and heights so I can add them into te HTML freely (
    .x100 { width: 100px; }
    .y100 { height: 100px; }
    ).

    This would negate the entire problem: I’d say heights and widths are the most frequent examples where the above usage could come in handy. I already use classes like the above to float or align elements and chain them on to the HTML.

  199. Anarm says:

    great sharing.. thanks for this info..

  200. ecardblog says:

    i need more bro. nice sharing.

  201. Dan says:

    Great page of advice! – I have used many of those things in the past and some I still do *ashamed face* I know I’m really just too lazy. But I do go back and change my site with these kind of things in mind when i have time.

    Cheers for posting

  202. natcancein says:

    Thanks man!!

  203. janet kern says:

    Enjoyed the tutorial. Makes me feel better because I never use inline styling-but see it in so many web tutorials/some books.

  204. Cliff Dyer says:

    The problem is that CSS should be bolding the text. In fact, it’s pedagogically misleading to say “{i} becomes {em} and {b} becomes {strong}.” Because then you don’t actually get any structural benefit from semantic markup. You just get a more semantic-sounding name for the same damn thing. In fact, {i} tags are sometimes better represented by {em} tags, and sometimes by {cite} tags. {b} tags are *sometimes* better represented by {strong} tags, sometimes by some level of {h[n]} tag, sometimes by {th}, and frequently by more domain specific semantic controls. For example, a site that uses bold links in a page should not have {a}{b}Foo{/b}{/a} peppered all over the place. It should just be {a}Foo{/a}, and the bolding should be styled. When do you use {b} tags that feels semantically appropriate to you?

  205. Ozh says:

    Wrong. For SEO matters, it can important to have b/strong tags on important keywords.

  206. Camilo says:

    That’s right. Good points. I think they all complement the article

  207. Camilo says:

    @Cliff Dyer: That’s right. Good points. I think they all complement very well the article.

  208. Ant says:

    Not anymore, really.

Comments are now closed