Trouble Styling HTML5 elements?
The Problem
I was editing the CSS of a SECTION element in a WordPress theme that was supposed to be HTML5-ready the other day and couldn’t get the changes to appear. Convinced that I must have misspelled the class name somewhere, I spell checked and went on a copy/paste frenzy. Still no luck.
The Solution
But luckily, once I found the fix, it was easy. HTML5 elements must have their display property set to block. Just add the following snippet toward the top of your CSS file (taken from the HTML5 Boilerplate):
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;}
But Wait. Our Good Friend, Internet Explorer isn’t Done Yet
If you (or your theme) haven’t done it already, you’ll need to add some JavaScript so you can style your elements. Otherwise IE won’t know these elements exist.
document.createElement('article');
document.createElement('header');
document.createElement('section');
etc..
About Me
Anthony is a web designer and developer living in San Diego who does not like referring to himself in the third person. I've been designing for ten years; and developing for five of those. When I'm not working on projects, I'm cooking, playing sports, spending time with my fiance, and arguing over whether or not baseball needs a salary cap.



