Select all the h tag inside a class
Asked Answered
E

2

8

Instead of writing the CSS code like,

.dark h1, 
.dark h2, 
.dark h3, 
.dark h4, 
.dark h5, 
.dark h6 {

}

Is there any short way to this like [class*="blah"]?

Regards.

Elutriate answered 25/1, 2013 at 11:32 Comment(0)
T
5

No, since attribute selectors work only on, well, attributes. You can't use a regular expression or something similar for element names. Certain systems like LESS or SASS enable you to write such expressions with less code, however there is no such thing in native CSS.

Throb answered 25/1, 2013 at 11:36 Comment(0)
K
3

No, there is no other way. A comma-separated list is what you can do at all, but, give the parent element ID and same class to all H tags then you can use that one class to modify all.

Kissee answered 25/1, 2013 at 11:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.