Can I target all <H> tags with a single selector?

SparrwHawk picture SparrwHawk · Sep 24, 2011 · Viewed 132.5k times · Source

I'd like to target all h tags on a page. I know you can do it this way...

h1,
h2,
h3,
h4,
h5,
h6 {
  font: 32px/42px trajan-pro-1,trajan-pro-2;
}

but is there a more efficient way of doing this using advanced CSS selectors? e.g something like:

[att^=h] {
  font: 32px/42px trajan-pro-1,trajan-pro-2;
}

(but obviously this doesn't work)

Answer

Dave Markle picture Dave Markle · Sep 24, 2011

No, a comma-separated list is what you want in this case.