0

i don't know how to select only the h1 without the span in css HTML:

  <h1>
    <span>hello from spam</span>
    <br> 
    heloo from h1 
  </h1>

2 Answers2

0

There are no parent selectors in CSS. Check:

Is there a CSS Parent selector?

Parent selectors in CSS

What you can do is styling both elements and then re-writing the style for the child. e.g.:

h1{
    color:blue;
}

h1 > span{
    color:black;
}
Chüngel
  • 375
  • 4
  • 19
-3

You can add style inside tag <h1> . For example:

<h1 style="color:red;">
Pete
  • 57,112
  • 28
  • 117
  • 166
Miosotaa
  • 23
  • 1
  • 11