Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Doubling up with HTML5 Elements & Divs

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32603
    phette23
    Member

    I’m a web design noob and I want to write a website using the new, semantic HTML5 elements like footer, article, section, etc. But, of course, there is Internet Explorer, which doesn’t allow styling of arbitrary elements, so I would have to use the javascript HTML5 shiv for my styles to stick. But I’m wondering: is there any disadvantage to simply nesting my non-semantic divs inside semantic markup, thus catering to both IE and modern browsers while avoiding javascript? Example:





    Any reason why I should avoid this? Or do only as a supplement to the shiv? It seems like, with the right resets, it would work fine but maybe I’m overlooking something. And also: is there a logic to the nesting which makes more sense? Divs on the outside and footer on the inside?
    Thanks.

    #47357

    The whole point of the new elements is so we don’t have to use divs. You’re essentially doubling the number of elements in your code by nesting divs and negating the purpose the new elements: cleaner and more semantic markup. The js shiv is a simple and clean solution for older versions of IE.
    If your project is going to have a lot of viewers using old IE versions without javascript enabled, maybe its not a project best suited for HTML5. You could also put a conditional noscript tag in that tells ie users the page may not view properly with js disabled.

    #47161
    phette23
    Member

    Ok, fair enough. I was thinking that, once my analytics indicated I was above a certain threshold of older IE versions, it would then be easy to strip out every div. But doubling elements and CSS isn’t worth it.

    #46866
    TheDoc
    Member

    In my oh so humble opinion, there really is no difference between a div with id=”footer” and the new “semantic” way of HTML5.

    The best option would be to start using the new HTML5 doctype and keeping your divs for now. Over time you’ll be slowly able to transfer over.

    #46814
    chrisburton
    Participant

    I think it certainly serves a great organized point and would probably help solve a lot of issues and frustration, especially here. I’m not entirely sure on the “best option” as I think that is pure opinion. To stay in the present game, I personally use the new markup.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.