+ 3
Why can't I use <style> and <h1> for the same paragraph?
8 ответов
+ 12
<h1>
<p style="color:white; background-color: aqua;">
The text
</p>
</h1>
<!--
Khumayra Kimsanboeva
The code above is working fine. It may happen because h1 is an block element and it is not inherited with the properties of p tag.
Edit:
there is no need of strong tag
and you can also add style to H1 tag
<h1 style="color:white; background-color: aqua;"> Text here </h1>
-->
+ 3
Can you please attach your code here.
And there should be no problem you can use <style> and <h1> for same paragraph.
+ 3
But you are applying style to p element not h1
0
<p style="color:white; background-color: aqua;"><h1><strong>The text</strong></h1>
</p>
0
If I remove <h1> , the code works but otherwise it makes the heading but there is no style
0
Ohh understand . Thank you))
0
Even if the element is inline it doesn't inherits all the properties of parents .
0
Semantically speaking, an "h1" element is not supposed to be inside the "p" paragraph element. Also strong wouldn't be effective on Heading tags. They are bold/strong by default.
Here's how it should be
<p style="color: white; background-color: aqua;"><strong>some text</strong></p>
or
<h1 style="color: white; background-color: aqua;">some text</h1>