HTML5 role=main, how to style

css, html

Solution

I would recommend adding an ID or class. It's the most cross-browser and efficient way.

If you can't do this, then you'll need to use an attribute selector:

div[role="main"]

Problem

If I have ``` <div role="main"> </div> ``` How do I style `main` with CSS? Or do I also have to add an ID or a class to the `<div>`?

Original source