-1

How can I combine elements in my CSS? Here's what I've got now:

#someID .some-class h1 {
    color: blue;
}

#someID .some-class h2 {
    color: blue;
}

#someID .some-class h3 {
    color: blue;
}

and what I'd like to do is something like this:

#someID .some-class h1 h2 h3{
    color: blue;
}
  • 3
    I highly recommend you to read some CSS tutorial. As your question is basic syntax question [read here](https://www.w3schools.com/css/css_syntax.asp) – bugwheels94 Apr 06 '17 at 18:42
  • Possible duplicate of [css multiple class / id selectors?](http://stackoverflow.com/questions/3458169/css-multiple-class-id-selectors) – trincot Apr 06 '17 at 20:55

4 Answers4

0

Separate the whole selector group with a comma:

#someID .some-class h1, #someID .some-class h2, #someID .some-class h3 {
    color: blue;
}
sn3ll
  • 1,619
  • 1
  • 10
  • 16
0

In pure CSS you'll just have to list all the selectors separated by commas. Note that, again in pure CSS, you'll have to include the whole thing even if part of it is the same.

Roope
  • 4,325
  • 2
  • 25
  • 50
0

With Commas

#someID .some-class h1, #someID .some-class h2,#someID .some-class h3{
    color: blue;
}
camccar
  • 682
  • 10
  • 23
0

I would target the class instead of id and class. Here is a working example JSFiddle

.some-class h1,
.some-class h2,
.some-class h3 {
  color: white;
}
scarsam
  • 326
  • 1
  • 12