Falling for HTML5: Finding Love in the Little Things

Advertisement

I’ve lost count of the number of posts that have been written about the big features of HTML5: amongst the most anticipated being rich media (video, audio, canvas) and JavaScript APIs. However, call me a woman of simple tastes, but this is not the sort of thing that gets me swooning. What does? The small additions to the spec that will make the world of difference to the way I code day-in, day-out. This is the stuff fairy tales are made of.

The ugly duckling

HTML has had a troubled past. It was never really designed for what we are now accomplishing with it. This is in part a testimony to its flexibility and adaptability, but there have been inevitable growing pains.

So what was it originally intended for? Well it’s there in the name: Hyper-Text Markup Language. Yes, text; hyper-text to be more exact. Not layout, or images, or video, or fonts, or menus — or any of the other frippery that it now incorporates.

All these techniques started as “hacks” — ways of extending the language which were not accounted for in the original spec. Some of the hacks were uglier than others. For example tables for layout (eek!) were a workable (and reliable) way to manipulate the display of information. Similarly, sIFR and other JavaScript techniques often account for things that would more naturally be handled natively by the browser, but at the time were not.

The handsome prince

What we need is someone to come to our rescue. In steps HTML5.

The spec is full of ‘a-ha’ and ‘of course’ moments, and that’s not a surprise seeing as one of its founding design principles is that of paving the cowpaths:

“When a practice is already widespread among authors, consider adopting it rather than forbidding it or inventing
something new.”

— HTML Design Principles, W3C Working Draft 26 May 2009

What this means on the ground is that many of the hacks which are used to bend the existing HTML Doctype to our will are now being legitimised in HTML5. Let’s take a look at three examples which are guaranteed to make every front-end developer smile:

The <a> element

This little beauty is fundamental to how the whole web operates, but up until HTML5 it has been very limited. Limited, in fact to being solely inline. Want to create a large clickable banner which wraps around a title, image and text? Well, you’re out of luck. plain ol’ HTML4.01 won’t let you — not without JavaScript that is.

However, now that the <a> tag has been declared a block-level within HTML5, there is no end to the elements you can wrap it with. You can confidently (and legitimately) have your <p> and link it too!

Forms: the place-holder

Web forms are complex things, and we have developed a number of JavaScript add-ons to make them more usable: date pickers, auto-completes, required elements, validation. A lot of these have a new home in HTML5 but I’m going to focus on one common technique: placeholder text.

This is used where you have a text field but you want to prompt the user — either with the format you would like the text entered (such as a date) or with an example. It is sometimes used in-place of a label when space is premium. Up until now, using placeholder text has required a JavaScript function that auto-clears on focus, and reinstates when the element loses focus (if it has not been replaced by user-entered text). Quite a complex task, one which is now accomplished by the following snippet:

<input id=”examples” name=”examples” type=”text” placeholder=”Enter the things you love about HTML5” />

input showing placeholder attribute
The placeholder attribute removes the need to add JavaScript to input elements

Section element

Have you ever run a validation on a page and died inside when the following error has come back?

“WCAG v1 3.5 (AA)] Nest headings properly (H1 > H2 > H3”…”

It might be just me, but this error is particularly hard to fix. Imagine a scenario where you have a main column with heading levels inside the content, followed by a right-hand column containing featured items e.g.

<div id=”mainCol”>
<h1>Main title</h1>
<h2>Secondary title</h2>
</div>
<div id="featureCol”>
<h4>Title of feature</h4>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem
accusantium doloremque</p>
</div>

Without knowing what content will be entered in the main column, how do you choose the correct level of heading to start the following column with? You could play it safe and use an h2, but does this really signify the correct semantic importance of this content? Probably not.

HTML5 introduces something called a section element. Each section has its own hierarchy, so you can now have multiple h1s on a page. Do I hear you saying ‘a-ha’? As well as eliminating the above error, this also means that content can be more easily reused. For example, when using a CMS, the modules and components can be reordered on a page without having to consider how this might upset the existing hierarchy. Genius.

Happily ever after

Ensuring you code 'happily ever after'

The best news by far is that we can start implementing many parts of the HTML5 spec right now. This is due to another founding design principle; graceful degradation:

“On the World Wide Web, authors are often reluctant to use new language features that cause problems in older user agents, or that do not provide some sort of graceful fallback. HTML 5 document conformance requirements should be designed so that Web content can degrade gracefully in older or less capable user agents, even when making use of new elements, attributes, APIs and content models.”

— HTML Design Principles, W3C Working Draft 26 May 2009

That means no more waiting for IE6 to fall of its perch, or constantly asking ‘is HTML5 ready yet?’ like the impatient child in the back car seat. It means continuing to support IE6 (for most of anyway) but shattering the myth that a website should look exactly the same in all browsers. It means carefully considering which HTML5 elements to use, which CSS3 selectors and properties to adopt to ensure we are building websites for tomorrow, not today.

Changing habits

In the short term it’ll mean a bit more work for us in the templating process, and we might need to adapt our workflow accordingly. Here are some questions you might need to ask yourself:

  • Have I adjusted my estimates to allow for adapting the design in different browsers?
  • Have I given myself enough time during build to familiarize myself with new processes and techniques?
  • Have I set the right expectations with my client / the designer / my manager about how the website will look across different browsers?
  • Are there few enough users to degrade support for IE6?
  • Do I need to include JavaScript to add support for CSS3 and HTML5 features in older browsers?

It might seem like a lot of hard work, and something to be put off, but ignore the changing landscape at your peril. Besides, you’ll have plenty of time on your hand as soon as you stop slicing up all those images to add rounded corners, drop shadows and gradients to your design!

So how will this fairytale end? Crack-open your favourite code-editor, type “<!DOCTYPE html>” and you get to write it…

Interface developer and user experience specialist at Reading Room with a strong desire to marry robust, semantic code together with beautiful and usable websites. Felicity has been producing websites for almost 9 years and is still learning how to do it better. Projects she has worked on include Skoda, Hill & Knowlton, Wellcome Collection and NHS Smokefree.

  1. 1

    Shaun Bent

    January 21st, 2011 3:05 am

    Great article very much makes sense!

    I have been using HTML5 for some time now and love it. One thing I particularly like is now I am using HTML5 I find myself very much focused on semantics (where I wasn’t in the past), I am taking the time to ensure I am using the best possible element and everything is in the right place.

    One thing I have noticed about the normal comments you get on posts about HTML5 is everyone seems to focus on Video, Audio or Canvas and how they are not supported enough to be used on clients sites thus you can not use HTML5.

    I have now developed several sites using HTML5 and only one of them required video. So my use of HTML5 is really based on the new semantic elements such as nav, article etc of which the shiv is the only thing needed for support in IE, so I don’t see any reason not to be using HTML5 if only to make use of these new elements.

    Another little thing which is overshadowed by Video, Audio and Canvas is the “data-*” attribute so you do not need to store information in class’s, ID’s or other attributes for use with jQuery (or another library), just makes your code feel clean.

    +15
    • 2

      Sandeep

      January 21st, 2011 2:55 pm

      I use “data-” a lot with jQuery.

      +3
  2. 3

    Steve Fenton

    January 21st, 2011 3:35 am

    I agree with Shaun – it’s nice to read about HTML5 rather than CSS3, JavaScript and video formats.

    It is also nice to see good reasons for people to use HTML5 right away – rather than waiting for some magical date in the future. Especially as there are methods for making it work in older browsers already:

    http://www.stevefenton.co.uk/Content/Blog/Date/200907/Blog/HTML-5-Browser-Test/

    Hope to read more from you on this subject soon.

    +6
  3. 4

    Daniel H Pavey

    January 21st, 2011 3:38 am

    Nice article, thanks.

    I agree with Shaun, it’s nice to see a post that doesn’t bang on about the canvas tag all the time!

    I have not started using HTML5 yet put your post is encouraging me to pull my finger out and start implementing it!

    +8
  4. 5

    Joakim Lidström

    January 21st, 2011 3:46 am

    I am now officially an HTML5 convert. I have also been quite unimpressed with the flashy HTML5 presentations all over the Web, evangelizing the coming of the new age of the web or whatever. This down-to-earth article was spot on – why HTML5 is so great for the day to day development operations and why we should start using it now.

    Thank you, Felicity.

    Joakim Lidström
    Web designer, Sweden

    +3
  5. 6

    Ralph

    January 21st, 2011 4:00 am

    I totally agree with you, Felicity (cool name btw)!!!

    I just started a month ago dabbling into HTML5. Before that, I have to admit, I was also more negative about it then positive. After reading Hardboiled Web Design from Andy Clarke, I got exited and started to experiment (also with CSS3) and now I think why the hell did I wait so long for it to happen. I look now more forward in my development process then backward. I just use now what is save to use and it will only get better and better. Of course I do support still the older and less capable browsers, but I’m not going to spend endless hours anymore writing hacks or workarounds for them. They just get a simplified version of the site… as simple as that!

    +3
  6. 7

    Stefan Gelenchev

    January 21st, 2011 4:01 am

    @Joakim thing is all those online presentations of HTML5 are pure Javascript using some HTML5, they do not show nor do they explain something about HTML5.

    Articles like this one here are the real deal, making us designers want to try HTML5 right now, so thank you Felicity, I will follow your advice :)

    +3
  7. 8

    Gareth Clubb

    January 21st, 2011 4:17 am

    HTML5 should very much be about the semantics of the markup. People get easily carried away by new technologies and think its all about pushing limitations of what current platforms can do – it’s not!

    A well written article Felicity, thanks for bringing people back down to earth.

    Lets hope people focus on what matters and implement HTML5 today, in the way it was intended.

    +5
  8. 9

    Scott

    January 21st, 2011 4:30 am

    Placeholders are one of the worst inventions ever, they suck for usability. First they get in your way in the field, and are too easy to confuse with pre-filled fields. As soon as you type one letter the placeholder disappears unexpectedly. And of course, as soon as the placeholder text disappears, you’ve lost whatever instruction was there.

    I’m of the opinion that if you need placeholder text you are doing something wrong. Stop trying to cram your form into the tiniest of spaces; let is breathe and add some proper labels.

    -15
    • 10

      Felicity Evans

      January 21st, 2011 8:02 am

      @Scott I never meant to imply that a placeholder should replace a label – indeed if we’re talking semantics a label should always be present (although sometimes it’s visually hidden).

      However I think there is a legitimate use for placeholder within the spec, for example if you want a phone number to be input in a certain format e.g. including international codes then a placeholder can indicate what would otherwise take an entire sentence to explain.

      +9
      • 11

        Milk

        January 22nd, 2011 4:00 pm

        The correct thing to do is to allow any format of phone number. There will be more coding for the programmer to correctly parse multiple formats, but the end result is less headache for the user.

        0
        • 12

          Steve Fenton

          January 24th, 2011 2:22 am

          I think we are missing the point a bit – Yes, there should be a lable and yes, we should allow them to use dashes, or spaces and just format how we like – but the placeholder is already something we know is useful as many of us are using JavaScript plugins to achieve it.

          In Felicity’s response above, hinting that you need an area code, for example, is something that you can’t “fill in” for the end user.

          +4
  9. 13

    Vernon Kesner

    January 21st, 2011 4:30 am

    I do like the new article and section elements, but I’m not sold on the multiple H1′s on a page yet. It just feels dirty to me.

    I definitely see search algorithms changing a bit as there will be an influx of pages starting to adopt and use this ability. This could mean that source order will hopefully become a bigger priority to those who may not pay complete attention to it now.

    +1
    • 14

      Felicity Evans

      January 21st, 2011 8:06 am

      @vernon I’m not in a position where I can use a lot of the new elements in my day-to-day work, however long-term I think this approach is one that acknowledges how the use of the web has changed. It was originally an academic medium for publishing papers (so a single H1 fits this scenario) however it has moved to becoming a method of curating a number of streams of information (often within one page), so we need a fundamental shift in how we semantically mark-up content.

      +4
  10. 15

    Ramsey

    January 21st, 2011 4:42 am

    If you want a large clickable area with block level elements, HTML4 has always had a solution for you. The button tag allows practically any content with the exception of form elements and the anchor. Now you’re probably saying to yourself, “Yeah, but without a form or Javascript, a button doesn’t DO anything.” Well, sure, until you wrap it with an anchor!

    [a href="http://www.smashingmagazine.com"][button]block content[/button][/a] works perfectly in every browser except one. Right, IE. It’s always IE. Even IE8 fails with buttons wrapped by anchors. Unfortunately, redefining the anchor tag to allow block content doesn’t make IE a better browser. If only it were that easy…

    -15
  11. 16

    Eliecer

    January 21st, 2011 5:25 am

    Congratulations. It´s a very good article. I don´t use HTML5 at this time, but i’ll test it soon…

    Cheers.

    0
  12. 17

    Nick

    January 21st, 2011 5:36 am

    “Want to create a large clickable banner which wraps around a title, image and text? Well, you’re out of luck.”

    Well, it has always worked but not validated.

    Which begs the question where the problem actually was. Another way of putting what is expressed in this article with respect the ‘a’ tag might be that validation is finally catching up with what people are actually coding?

    Evidently design and programming practice lead validation.

    If validation actually led designers and programmers then that would be like saying that we won’t do anything until we are told that we are absolutely categorically allowed to do it.

    Not a sure fire way of inspire creativity. I pray that the creative of you all find ways to bend the html5 rules even further . Validation is for sissies ;-)

    -5
    • 18

      Felicity

      January 21st, 2011 12:17 pm

      @nick I did mean that it wouldn’t validate, which is a fault of the original spec. My point was that HTML5 is legitimising common practice – once we get settled into HTML5 I expect we will start to push the envelope with what’s possible – and then it’ll be time for the spec to catch up again!
      In the meantime there’s plenty to be thankful for and the APIs demonstrate that the spec is forward-thinking and not merely reactive.

      +5
      • 19

        ilana

        January 21st, 2011 4:01 pm

        not to be nitpicky, but can’t you just use some css to declare an a tag into a block and apply a background image. I’ve never had a problem with that validating.

        +1
        • 20

          Felicity

          January 22nd, 2011 4:13 am

          Try putting a p tag in there and your validation will quickly come unstuck

          +1
  13. 21

    Miro Keller

    January 21st, 2011 6:04 am

    What I’m seeing is that the markup written with HTML5 is being more and more tied to the presentational aspect of a website, unlike in the old xHTML days.

    I believe the content of a website should be marked up in a way that is purely semantic, that is, *what it is* instead of *how it looks like* or *how it behaves*. That’s the job of another layer in the tool chain, i.e. JavaScript for behavior. By putting placeholder text in the HTML, for example, you are already committing to a certain look and feel of the input box, determined by however browsers end up implementing it, instead of semantically structuring the information -in this case, what the heck a user is supposed to enter in the box-.

    +4
  14. 22

    faycal

    January 21st, 2011 6:19 am

    Great reading your article. I started working on HTML5 and found it quite revolutionary in the way we work with HTML. I also recommend the book “HTML for Web designer” which gives a good introduction on the subject.

    0
  15. 23

    Jon

    January 21st, 2011 7:09 am

    so can I start using something like placeholder text now? which browsers support it? if not all support it, does it play nice with the old javascript way of doing it?

    This sort of the thing can’t be dealt with using gracefull deradation (eg rounded corners for modern browsers, hard corners for older ones) it has to be provided to all users.

    0
  16. 24

    Dimpo

    January 21st, 2011 7:30 am

    This is f* annoying!
    By the time i finished reading the comment’s i’ve clicked 50 times (by mistake of course) the smashing book ad on the sides (which is blank)!

    Have mercy people!

    0
  17. 25

    Deryck

    January 21st, 2011 8:29 am

    HTML5 is by far the best markup specification with CSS3. Now everything is more oriented to presentational and the amount of time needed for slicing reduces a lot.

    You can start using HTML5 now, just using the propper DOCTYPE and thanks to graceful degradation all your XHTML code remains validated. Starting this point you cand insert as much HTML5 as you can or want.

    +2
  18. 26

    Will

    January 21st, 2011 9:10 am

    Great article. Very much appreciated. Has everyone seen the new HTML5 logo recently released by the W3C. Check it out.

    http://www.w3.org/html/logo/

    Also, check out my latest illustration supporting it.

    http://www.sleekdesignstudio.com/html5poster

    0
  19. 27

    Barry La Vette

    January 21st, 2011 10:00 am

    My next site will be html5 and I’ve always done graceful degradation allowing to use CSS3 wherever I can with the knowledge all sites will not look exactly. That’s OK, they still work and function beautifully. I know the new html5 now just putting it into practice is another thing. Good ending piece about time allocation during the build process.

    0
  20. 28

    Shadow Caster

    January 21st, 2011 10:19 am

    Like the statement, there’s another one that is short and sweet: . I use this all the time.

    0
  21. 29

    Patrick Ortman

    January 21st, 2011 10:31 am

    Yes, very cool to read about some of the “smaller” features of HTML5 and how it’ll help us build better websites, rather than another doom-and-gloom about Google not supporting H264 video in Chrome anymore, etc.

    P

    +1
  22. 30

    Joel

    January 21st, 2011 11:28 am

    Just wanted to point out to those who are using it, HTML 5 there are still some issues with screen readers, which you may want to take into consideration depending upon your client and what laws/regulations they are subject to.

    More info: http://www.accessibleculture.org/research/html5-aria/

    0
    • 31

      Shaun Bent

      January 22nd, 2011 3:30 am

      Thanks for the link, thats an interesting article.

      Did you know that the WC3 invited all the major screen reader vendors to join the HTML5 working group to give/get their input and they all declined.

      So the people who build the assistive technologies had their chance to have their say on HTML5 and they chose not to.

      +2
  23. 32

    Audrius Jankauskas

    January 21st, 2011 11:34 am

    Very nice and easy to read article. As for web software developers it’s always a hard decision which browsers we need to support. HTML5 is a very big step forward.

    However, graceful degradation still takes more time than we would want. Everything goes around IE. You want it or not. In one way or another. IE6 gave us a very hard time. I hope IE9 will be a relief.

    0
  24. 33
  25. 34

    Paceaux

    January 21st, 2011 3:58 pm

    I’ve been reading up on and using a lot of the HTML5 markup, but the <a as a block element was something I missed. That's very good to know.

    I'm curious about the meaning that I can put in new hierarchies. Is Google now okay with multiple H1s? It sounds like a good idea, but I fear that it might not be good for Google Juice just yet. But thank you for putting it in the perspective of using the section element as a CMS module.

    0
    • 35

      Steve Fenton

      January 24th, 2011 2:29 am

      @Paceaux – the multiple H1 thing is definitely something the specification wants to encourage – but even I admit that my H-tags on my HTML5 website are still arranged in a nicely nested order under a single H1.

      I must admit, I never really felt constrained by the “one H1″ rule in the first place and even with a page full of aggregated content, there must surely still be a single title it can all live under!

      +4
  26. 36

    Yogesh Dhakal

    January 21st, 2011 9:31 pm

    very nice article ..

    0
  27. 37

    Allen Gingrich

    January 21st, 2011 11:01 pm

    HTML5 scares the hell out of me. Not because it’s difficult (it’s easy!), but because of the confusion in support for it. I read an article two months ago on a commendable blog that told me I could begin using the ‘header’ and ‘footer’ elements, as well as the HTML doc-type for my website. Everyone in the comments section seemed to go along with it — so I built a site using these specifications.

    Since HTML is only a markup language, insanely simple, and I could literally do it with my eyes closed, I no longer validate my pages or check what they look like in Internet Explorer. There’s no need because they always validate and they always look correct. I’ve been doing this too long for them not to.

    Well not this time. My website was destroyed in Internet Explorer 8 and below… right in the middle of a client presentation. Boy was I embarrassed.

    Heed my words: Don’t believe any specs are usable until you try them yourself!

    0
    • 38

      Scott

      January 22nd, 2011 4:32 pm

      Not testing your project in the most common browsers was a ridiculous thing to do.

      Secondly, if you’d have read even a tiny bit about HTML5 compatibility in IE you’d have read that IE does not recognize the new elements and cannot style them without a bit of javascript.

      It’s absolutely ridiculous that you would put the blame for this entirely on HTML5, especially when it was clearly your own fault.

      +5
    • 39

      Anrkist

      January 24th, 2011 7:11 am

      Test. Test. Test. And test some more. Always. Many of us have the problem of being over confident when it comes to our code but that should never stop you from testing it.

      +1
      • 40

        Chris

        March 7th, 2011 2:18 pm

        @anrkist – I tell that to my code writter all the time. Checking your work is so important. I cant tell you how many mistakes I catch that turn into hours of work, simply from a spelling error or a stray keystroke.

        0
  28. 41

    paddywhack

    January 21st, 2011 11:19 pm

    It should also be noted that it is no longer called HTML5. It is now just plain ol’ HTML. HTML5 will now become an all encompassing term for all the new web technologies that were being lumped in with HTML5 even though they weren’t part of the spec.

    http://blog.whatwg.org/html-is-the-new-html5

    0
  29. 43

    FlaDev

    January 21st, 2011 11:46 pm

    Nice article, here is another discussion about HTML5 and Flash if anybody is interested http://www.fladev.com/articles/html5-and-flash/

    0
  30. 44

    Syam

    January 22nd, 2011 2:28 am

    Good article..testing soon :)

    0
  31. 45

    Gaurav M

    January 22nd, 2011 4:06 am

    Hoping that HTML5 will save the designers who are messing the hands on multiple browsers by writing clean disciplined code. And the promotional activities by HTML5 adopters, creators and producers will be digested well by the clients too.

    Already started implementing HTML5 for the client work! Client recommended that :- )

    0
  32. 46

    Lars Gunther

    January 22nd, 2011 8:07 am

    Some confusion about the a-element seem to exist both in the article and the comments.

    The a-element has not been declared “block” level. If it had, it would be illegal to have it inside a span, an em or any other “inline” element. I put inline in quotes, because what has happened is that HTML5 is doing away with the block/inline distinction, in favor of a new content model:

    http://www.w3.org/TR/html5/content-models.html

    Thus, the a-element is neither inline or block. And yes, this is the way it has always worked, de facto, in all all browsers.

    Ramsey’s trick to wrap an a around a button is thus not needed. You can and now you also may wrap an a around a div, to your hearts content.

    +1
  33. 47

    Archie

    January 22nd, 2011 9:08 am

    Any other new thing than HTML 5? We(designers) liked it already. We are only fast as what is next to us, and next to us still have old browsers.

    +1
  34. 48

    Patrick

    January 22nd, 2011 9:13 am

    Good article, thanks. I hadn’t picked up that ‘a’ was now a block-level element. Fantastic, and very useful!

    I still have issues with headings, mind. I do see the reason for them to be reworked, and generally I approve, but having recently created a page that, due to semantic structure, had only h1′s (and quite a lot of them) and no other headings, I couldn’t help but feel a little uncomfortable. I realize this is because I am still thinking of headings in the old way as creating the structure of the page, rather than other elements being responsible for the structure, but it’s going to take time to adapt.

    Also, I still find it nearly impossible in some instances to distinguish whether something should be an aside or a separate section (particularly when other people will be creating the content and it might reasonably turn out to be either).

    0
  35. 49

    Lars Gunther

    January 22nd, 2011 10:17 am

    Just to prove my point, Patrick confirms that some people do indeed think that the a element is block level. Could this error please be changed in the article?

    +1
    • 50

      Felicity

      January 22nd, 2011 12:01 pm

      Lars, perhaps I should have clarified that the a elements acts like block level in the html5 spec,

      “The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links). This example shows how this can be used to make an entire advertising block into a link”

      http://dev.w3.org/html5/spec/Overview.html#the-a-element

      I’ll have to read up on those new content types – thanks for the link

      +3
  36. 51

    Stewart

    January 22nd, 2011 12:14 pm

    Really good info. Definitely getting on the HTML5 with my next development.

    0
  37. 52

    Djoka Lazin

    January 22nd, 2011 2:18 pm

    May I ask why don’t you use html5 on smashing magazine when you are so in loved with it? :)

    0
    • 53

      Steve Fenton

      February 8th, 2012 4:16 pm

      Djoka – this was a good observation, which you may now notice has been followed up on!

      0
  38. 54

    Simon

    January 23rd, 2011 2:17 am

    Funny and well written article.
    Wasn’t aware of the placeholder feature.

    Were you aware of the hgroup element.
    You can next H1,2,3 in those out of sequence too.

    http://html5doctor.com/the-hgroup-element/

    0
  39. 55

    CynicalOne

    January 23rd, 2011 6:09 am

    Um, Felicity, you’ve invented a whole bunch of problems that don’t actually exist in HTML.
    ++You CAN wrap thew A tag around several elements already
    ++ You can place default text in form fields already
    ++ You can already name your “sections” like “header” and “footer” already.
    ++Unless you mean placing one H tag inside another by the term “nesting”, you can already nest your H tags in any way you want. surely you don’t mean you’d like to place a H4 tag inside an H2 tag or vice versa do you?

    -7
    • 56

      Steve Fenton

      January 24th, 2011 2:38 am

      1) You CAN wrap thew A tag around several elements already

      Wrap a div-element in an a-element and run it through validator.w3.org

      2) You can place default text in form fields already

      You can put a default value in the form field, that is semantically different to hint-text.

      3) You can already name your “sections” like “header” and “footer” already.

      This isn’t naming a div-element, this is using semantically different elements to represent articles, sections, asides, headers, footers, navigation… in a standardised way that can be interpreted by computers where required.

      4) Unless you mean placing one H tag inside another by the term “nesting”, you can already nest your H tags in any way you want. surely you don’t mean you’d like to place a H4 tag inside an H2 tag or vice versa do you?

      My interpretation of the article is that, while currently you are only supposed to have a single H1-element, and all further elements should nest beneath it – you will be able to have many H1-elements, with the H1-element being interpreted as “the main heading for the article or section it is within” rather than “the main heading for the page”. “Nesting” in this meaning relates to this…

      —-H1
      ——–H2
      ————H3
      ——–H2
      ————H3
      ————H3

      The W3C call this an “outline”. It assumes that a H3-element is treated as nested inside of the first H2-element above it. “Nesting” doesn’t mean placing a H-element inside of another in this context.

      +5
      • 57

        Ramsey

        January 27th, 2011 10:34 am

        > Wrap a div-element in an a-element and run it through validator.w3.org

        [a][button][div]This tag structure validates[/div][/button][/a]

        So to say “Want to create a large clickable banner which wraps around a title, image and text? Well, you’re out of luck. plain ol’ HTML4.01 won’t let you” is just wrong.

        -7
        • 58

          Shaun Bent

          January 27th, 2011 10:50 am

          That may validate but would you honestly use that horrible mess of elements on your site and be happy with it?

          And surely that has to be a bug in the validator as it is just horrible!

          +1
          • 59

            Ramsey

            January 27th, 2011 12:07 pm

            Semantically, a button is a ‘large clickable’ area. I think it’s the most appropriate, semantically correct tag arrangement to use if you want a button with imagery and block text. Honestly. That’s what the button tag was designed to do. It isn’t a bug in the validator, check the DTD.

            -7
          • 60

            Shaun Bent

            January 27th, 2011 1:39 pm

            lol fair enough then! :D

            0
          • 61

            Steve Fenton

            January 28th, 2011 5:46 am

            Just to clarify the semantics of the HTML 4.01 button element, it is intended to be used as buttons created with the “input” element, but allows richer rendering possibilities. It is not intended to be used as a banner-link (you CAN use it as a banner link, but this is not the intended use or the semantic meaning of the element).

            +4
          • 62

            Ramsey

            February 4th, 2011 7:45 am

            @Steve Fenton
            I don’t see any semantic meaning assigned to the button in the W3 recommendation, although I may be looking in the wrong place.

            http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1

            It is my understanding that button, when used as a push button, is a general purpose button element. It is typically associated with forms because of its reset and submit types, but there are no restrictions on using push buttons anywhere inline content is allowed.

            Semantically speaking, a header, image, and text wrapped in nothing but an anchor sounds like the #target of a different anchor to me. Users should be aware that double clicking the text inside that anchor may take them away from the page or fire a javascript rather than selecting the text as they might have expected. A button element confers that meaning succinctly and would appear to be the most semantically appropriate element for this purpose.

            -7
          • 63

            Steve Fenton

            February 5th, 2011 8:15 am

            @Ramsey

            The specification for the button element is here:

            http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON

            It is synonymous with an input of type “submit” (or “image”). It is intended to be used as part of an HTML form.

            My point is this, you can’t “make up” the semantic meaning of an HTML element, the semantics are defined in the W3C specification.

            I’m not saying you can’t use a button element as you describe, or that it won’t validate as correct HTML, I am just saying you can’t claim it has any semantic meaning that makes it an appropriate choice for a banner.

            You’re section on double-clicking text I assume is a mistype as anchors are single-clicked. Anchors change the document location in all scenarios, so users are already acutely aware that this will happen when they click on a link.

            +4
          • 64

            Ramsey

            February 8th, 2011 9:26 pm

            @Steve Fenton

            >It is synonymous with an input of type “submit” (or “image”).

            The default type=”submit”. It is not synonymous. A button can also be type=”reset” and type=”button”. The whole point of type=”button” is to allow for completely arbitrary behavior not tied to form submission.

            >It is intended to be used as part of an HTML form.

            I think we’re going to have to agree to disagree. I believe that if it were not intended to be used outside of a form, the spec would have clearly indicated that. Just as the spec clearly indicates that using an image with a usemap attribute inside a button is wrong.

            > My point is this, you can’t “make up” the semantic meaning of an HTML element

            I would make the same point to you. The spec does not specifically forbid it. If using a button outside of a form were wrong, they would have said so. It validates. The DTD specifically allows it. Without any text in the spec forbidding it, I’m going to continue to believe that I am right.

            > You’re section on double-clicking text I assume is a mistype as anchors are single-clicked.

            I’m simply pointing out that attempts to select the text inside the supposed hyperlink is going to result in the link being clicked. On my Mac, double click selects a word. Triple click selects a paragraph.

            Do you expect random copy to link you to another page when you try to copy it and paste it elsewhere? I don’t. Do you think any designer is going to make their entire paragraph blue underline? I don’t.

            So what will happen? I suspect the designer will style this Anchor contraption to look like a clickable … drumroll please… button! You can call it a banner if you want. I see a big button. That’s why I think button is the most semantically correct element to use. For the visually impaired, the button element itself would convey this same meaning.

            So, maybe you understand my perspective. I suspect you still disagree with me, and that’s fine. Having anchor as a block element will still be nice. I won’t need to wrap skip navigation links in a stupid div. That’s progress.

            -7
  40. 65

    Moksha

    January 23rd, 2011 11:29 am

    very good article thanks for it

    0
  41. 66

    Sean from MRN

    January 23rd, 2011 6:38 pm

    Hi Felicity,

    Great article. Very informative. I visit this website frequently.

    Keep it up.

    Sean

    0
    • 67

      Felicity Evans

      January 25th, 2011 2:46 am

      Thanks Sean (from MRN), it’s good to know I have some sympathetic readers here at SM!

      0
  42. 68

    Juju Web Designs

    January 23rd, 2011 9:54 pm

    Great Post, Felicity. I love your sense of humor ( have your and link it too!).
    We are been experimenting with html5 for several months now in regards to video to replace flash, with great results. We’re also experimenting with wordpress themes and html5 too.
    Don’t like the new html5 logo though, it looks too much like an “S”.

    -Juju

    0
  43. 69

    Jeff

    January 24th, 2011 10:00 am

    Great article, but I’m still not sure how HTML 5 is supposed to make things better. Especially since the immediately following the section on graceful degradation you talk about a bunch of added work you need to do in order to implement it.

    Now I don’t only need to design for every browser, I need to design for different versions of markup as well…

    I’ll be convinced when Microsoft sends out an update requiring all users to upgrade their browsers to something compliant. First, of course.. they have to make a compliant browser.

    -1
  44. 70

    Mufeed Ahmad

    January 24th, 2011 10:38 pm

    amazing………what i have to say is… m love in it..:)

    well i really happy to see the world is following this new tech with so excitingly and in a positive way to build the web more semantic.. I am agree with all the markup guidelines , discussion and events.

    Thanks
    Mufeed Ahmad

    +1
  45. 71

    Friendly Troll

    January 24th, 2011 10:48 pm

    Have I adjusted my estimates to allow for adapting the design in different browsers?

    No, I’m using Flash.

    Have I set the right expectations with my client / the designer / my manager about how the website will look across different browsers?

    No, I’m using Flash.

    Are there few enough users to degrade support for IE6?

    No, I’m using Flash.

    Do I need to include JavaScript to add support for CSS3 and HTML5 features in older browsers?

    No, I’m using Flash.

    -9
    • 72

      Shaun Bent

      January 25th, 2011 1:20 am

      Are you a complete muppit?

      Yes!

      +4
      • 73

        Shaun Bent

        January 25th, 2011 2:11 am

        Maybe that’s a little harsh!

        A question though? If you are “using Flash” then why are you reading an excellent post about HTML5 and leaving probably the most irrelevant comment ever conceived?

        +2
  46. 74

    James Random

    January 25th, 2011 4:13 am

    First Gap, then Starbucks, now this. How much longer must the masses suffer generic and boring Graphic Design?

    -7
  47. 75

    Dave Bergschneider

    January 25th, 2011 7:46 am

    I can’t wait until the day I will be able to use HTML5 on a regular basis. It would open the doors to a lot of new opportunities in the users experience arena.

    -3
    • 76

      Shaun Bent

      January 25th, 2011 9:03 am

      Just out of interest why can you not use it on a regular basis now?

      +2
  48. 77

    Melissa

    January 26th, 2011 1:31 pm

    Wonderful article! I didn’t know until now that you can have different heirarchies within the same webpage with HTML5. That certainly solves a lot of my problems! =]

    +3
  49. 78

    Some guy

    February 6th, 2011 6:18 am

    I already used A tag to wrap block tags, and I didn’t care about validator errors at all. There were some problems with old versions of IE and Opera, but I fixed them.

    -3
  50. 79

    Warren Laidler

    February 21st, 2011 10:32 am

    Very good article. Informative and inspiring. Thanks for sharing your knowledge through great writing.

    0
  51. 80

    sinreal27

    March 10th, 2011 7:13 pm

    I am now an in-school, internship in a company, hoping to learn something more, know more.terracotta army。

    0
  52. 81

    Brett Widmann

    March 23rd, 2011 6:12 pm

    As they say it’s the little things that mean the most! Great article!

    +1
  53. 82

    Cuthbert

    December 13th, 2011 7:45 pm

    It is actually a nice beneficial piece of info. So i am thankful you shared this handy info around. Be sure to keep informed in this way. Thanks for sharing.

    0
  54. 83

    Gert-Jan

    February 1st, 2012 4:10 pm

    Very nice article!

    I must say this article inspired me to start using and start trying out more features from HTML5 then the typical video/audio and Canvas features!

    0
  1. 1

    Shaun Bent

    January 21st, 2011 3:05 am

    Great article very much makes sense!

    I have been using HTML5 for some time now and love it. One thing I particularly like is now I am using HTML5 I find myself very much focused on semantics (where I wasn’t in the past), I am taking the time to ensure I am using the best possible element and everything is in the right place.

    One thing I have noticed about the normal comments you get on posts about HTML5 is everyone seems to focus on Video, Audio or Canvas and how they are not supported enough to be used on clients sites thus you can not use HTML5.

    I have now developed several sites using HTML5 and only one of them required video. So my use of HTML5 is really based on the new semantic elements such as nav, article etc of which the shiv is the only thing needed for support in IE, so I don’t see any reason not to be using HTML5 if only to make use of these new elements.

    Another little thing which is overshadowed by Video, Audio and Canvas is the “data-*” attribute so you do not need to store information in class’s, ID’s or other attributes for use with jQuery (or another library), just makes your code feel clean.

    +15
  2. 2

    Felicity Evans

    January 21st, 2011 8:02 am

    @Scott I never meant to imply that a placeholder should replace a label – indeed if we’re talking semantics a label should always be present (although sometimes it’s visually hidden).

    However I think there is a legitimate use for placeholder within the spec, for example if you want a phone number to be input in a certain format e.g. including international codes then a placeholder can indicate what would otherwise take an entire sentence to explain.

    +9
  3. 3

    Daniel H Pavey

    January 21st, 2011 3:38 am

    Nice article, thanks.

    I agree with Shaun, it’s nice to see a post that doesn’t bang on about the canvas tag all the time!

    I have not started using HTML5 yet put your post is encouraging me to pull my finger out and start implementing it!

    +8
  4. 4

    Steve Fenton

    January 21st, 2011 3:35 am

    I agree with Shaun – it’s nice to read about HTML5 rather than CSS3, JavaScript and video formats.

    It is also nice to see good reasons for people to use HTML5 right away – rather than waiting for some magical date in the future. Especially as there are methods for making it work in older browsers already:

    http://www.stevefenton.co.uk/Content/Blog/Date/200907/Blog/HTML-5-Browser-Test/

    Hope to read more from you on this subject soon.

    +6
  5. 5

    Steve Fenton

    January 24th, 2011 2:38 am

    1) You CAN wrap thew A tag around several elements already

    Wrap a div-element in an a-element and run it through validator.w3.org

    2) You can place default text in form fields already

    You can put a default value in the form field, that is semantically different to hint-text.

    3) You can already name your “sections” like “header” and “footer” already.

    This isn’t naming a div-element, this is using semantically different elements to represent articles, sections, asides, headers, footers, navigation… in a standardised way that can be interpreted by computers where required.

    4) Unless you mean placing one H tag inside another by the term “nesting”, you can already nest your H tags in any way you want. surely you don’t mean you’d like to place a H4 tag inside an H2 tag or vice versa do you?

    My interpretation of the article is that, while currently you are only supposed to have a single H1-element, and all further elements should nest beneath it – you will be able to have many H1-elements, with the H1-element being interpreted as “the main heading for the article or section it is within” rather than “the main heading for the page”. “Nesting” in this meaning relates to this…

    —-H1
    ——–H2
    ————H3
    ——–H2
    ————H3
    ————H3

    The W3C call this an “outline”. It assumes that a H3-element is treated as nested inside of the first H2-element above it. “Nesting” doesn’t mean placing a H-element inside of another in this context.

    +5
  6. 6

    Gareth Clubb

    January 21st, 2011 4:17 am

    HTML5 should very much be about the semantics of the markup. People get easily carried away by new technologies and think its all about pushing limitations of what current platforms can do – it’s not!

    A well written article Felicity, thanks for bringing people back down to earth.

    Lets hope people focus on what matters and implement HTML5 today, in the way it was intended.

    +5
  7. 7

    Felicity

    January 21st, 2011 12:17 pm

    @nick I did mean that it wouldn’t validate, which is a fault of the original spec. My point was that HTML5 is legitimising common practice – once we get settled into HTML5 I expect we will start to push the envelope with what’s possible – and then it’ll be time for the spec to catch up again!
    In the meantime there’s plenty to be thankful for and the APIs demonstrate that the spec is forward-thinking and not merely reactive.

    +5
  8. 8

    Scott

    January 22nd, 2011 4:32 pm

    Not testing your project in the most common browsers was a ridiculous thing to do.

    Secondly, if you’d have read even a tiny bit about HTML5 compatibility in IE you’d have read that IE does not recognize the new elements and cannot style them without a bit of javascript.

    It’s absolutely ridiculous that you would put the blame for this entirely on HTML5, especially when it was clearly your own fault.

    +5
  9. 9

    Steve Fenton

    January 28th, 2011 5:46 am

    Just to clarify the semantics of the HTML 4.01 button element, it is intended to be used as buttons created with the “input” element, but allows richer rendering possibilities. It is not intended to be used as a banner-link (you CAN use it as a banner link, but this is not the intended use or the semantic meaning of the element).

    +4
  10. 10

    Steve Fenton

    January 24th, 2011 2:29 am

    @Paceaux – the multiple H1 thing is definitely something the specification wants to encourage – but even I admit that my H-tags on my HTML5 website are still arranged in a nicely nested order under a single H1.

    I must admit, I never really felt constrained by the “one H1″ rule in the first place and even with a page full of aggregated content, there must surely still be a single title it can all live under!

    +4
  11. 11

    Steve Fenton

    January 24th, 2011 2:22 am

    I think we are missing the point a bit – Yes, there should be a lable and yes, we should allow them to use dashes, or spaces and just format how we like – but the placeholder is already something we know is useful as many of us are using JavaScript plugins to achieve it.

    In Felicity’s response above, hinting that you need an area code, for example, is something that you can’t “fill in” for the end user.

    +4
  12. 12

    Shaun Bent

    January 25th, 2011 1:20 am

    Are you a complete muppit?

    Yes!

    +4
  13. 13

    Steve Fenton

    February 5th, 2011 8:15 am

    @Ramsey

    The specification for the button element is here:

    http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON

    It is synonymous with an input of type “submit” (or “image”). It is intended to be used as part of an HTML form.

    My point is this, you can’t “make up” the semantic meaning of an HTML element, the semantics are defined in the W3C specification.

    I’m not saying you can’t use a button element as you describe, or that it won’t validate as correct HTML, I am just saying you can’t claim it has any semantic meaning that makes it an appropriate choice for a banner.

    You’re section on double-clicking text I assume is a mistype as anchors are single-clicked. Anchors change the document location in all scenarios, so users are already acutely aware that this will happen when they click on a link.

    +4
  14. 14

    Miro Keller

    January 21st, 2011 6:04 am

    What I’m seeing is that the markup written with HTML5 is being more and more tied to the presentational aspect of a website, unlike in the old xHTML days.

    I believe the content of a website should be marked up in a way that is purely semantic, that is, *what it is* instead of *how it looks like* or *how it behaves*. That’s the job of another layer in the tool chain, i.e. JavaScript for behavior. By putting placeholder text in the HTML, for example, you are already committing to a certain look and feel of the input box, determined by however browsers end up implementing it, instead of semantically structuring the information -in this case, what the heck a user is supposed to enter in the box-.

    +4
  15. 15

    Felicity Evans

    January 21st, 2011 8:06 am

    @vernon I’m not in a position where I can use a lot of the new elements in my day-to-day work, however long-term I think this approach is one that acknowledges how the use of the web has changed. It was originally an academic medium for publishing papers (so a single H1 fits this scenario) however it has moved to becoming a method of curating a number of streams of information (often within one page), so we need a fundamental shift in how we semantically mark-up content.

    +4
  16. 16

    Felicity

    January 22nd, 2011 12:01 pm

    Lars, perhaps I should have clarified that the a elements acts like block level in the html5 spec,

    “The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links). This example shows how this can be used to make an entire advertising block into a link”

    http://dev.w3.org/html5/spec/Overview.html#the-a-element

    I’ll have to read up on those new content types – thanks for the link

    +3
  17. 17

    Melissa

    January 26th, 2011 1:31 pm

    Wonderful article! I didn’t know until now that you can have different heirarchies within the same webpage with HTML5. That certainly solves a lot of my problems! =]

    +3
  18. 18

    Joakim Lidström

    January 21st, 2011 3:46 am

    I am now officially an HTML5 convert. I have also been quite unimpressed with the flashy HTML5 presentations all over the Web, evangelizing the coming of the new age of the web or whatever. This down-to-earth article was spot on – why HTML5 is so great for the day to day development operations and why we should start using it now.

    Thank you, Felicity.

    Joakim Lidström
    Web designer, Sweden

    +3
  19. 19

    Ralph

    January 21st, 2011 4:00 am

    I totally agree with you, Felicity (cool name btw)!!!

    I just started a month ago dabbling into HTML5. Before that, I have to admit, I was also more negative about it then positive. After reading Hardboiled Web Design from Andy Clarke, I got exited and started to experiment (also with CSS3) and now I think why the hell did I wait so long for it to happen. I look now more forward in my development process then backward. I just use now what is save to use and it will only get better and better. Of course I do support still the older and less capable browsers, but I’m not going to spend endless hours anymore writing hacks or workarounds for them. They just get a simplified version of the site… as simple as that!

    +3
  20. 20

    Stefan Gelenchev

    January 21st, 2011 4:01 am

    @Joakim thing is all those online presentations of HTML5 are pure Javascript using some HTML5, they do not show nor do they explain something about HTML5.

    Articles like this one here are the real deal, making us designers want to try HTML5 right now, so thank you Felicity, I will follow your advice :)

    +3
  21. 21

    Sandeep

    January 21st, 2011 2:55 pm

    I use “data-” a lot with jQuery.

    +3
  22. 22

    Shaun Bent

    January 25th, 2011 9:03 am

    Just out of interest why can you not use it on a regular basis now?

    +2
  23. 23

    Shaun Bent

    January 25th, 2011 2:11 am

    Maybe that’s a little harsh!

    A question though? If you are “using Flash” then why are you reading an excellent post about HTML5 and leaving probably the most irrelevant comment ever conceived?

    +2
  24. 24

    Shaun Bent

    January 22nd, 2011 3:30 am

    Thanks for the link, thats an interesting article.

    Did you know that the WC3 invited all the major screen reader vendors to join the HTML5 working group to give/get their input and they all declined.

    So the people who build the assistive technologies had their chance to have their say on HTML5 and they chose not to.

    +2
  25. 25

    Deryck

    January 21st, 2011 8:29 am

    HTML5 is by far the best markup specification with CSS3. Now everything is more oriented to presentational and the amount of time needed for slicing reduces a lot.

    You can start using HTML5 now, just using the propper DOCTYPE and thanks to graceful degradation all your XHTML code remains validated. Starting this point you cand insert as much HTML5 as you can or want.

    +2
  26. 26

    Shaun Bent

    January 27th, 2011 10:50 am

    That may validate but would you honestly use that horrible mess of elements on your site and be happy with it?

    And surely that has to be a bug in the validator as it is just horrible!

    +1
  27. 27

    Lars Gunther

    January 22nd, 2011 10:17 am

    Just to prove my point, Patrick confirms that some people do indeed think that the a element is block level. Could this error please be changed in the article?

    +1
  28. 28

    Mufeed Ahmad

    January 24th, 2011 10:38 pm

    amazing………what i have to say is… m love in it..:)

    well i really happy to see the world is following this new tech with so excitingly and in a positive way to build the web more semantic.. I am agree with all the markup guidelines , discussion and events.

    Thanks
    Mufeed Ahmad

    +1
  29. 29

    Anrkist

    January 24th, 2011 7:11 am

    Test. Test. Test. And test some more. Always. Many of us have the problem of being over confident when it comes to our code but that should never stop you from testing it.

    +1
  30. 30

    Archie

    January 22nd, 2011 9:08 am

    Any other new thing than HTML 5? We(designers) liked it already. We are only fast as what is next to us, and next to us still have old browsers.

    +1

Leave a Comment

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!

↑ Back to top