0
CSS Html Question
I have the following code: <!doctype html> <style> h4 { color:powderblue; } .headline{ color:orange; } article{ color:purple; font-style: normal; } aside h4{ font-style: italic !important; color:yellow; } article h4{ font-style: normal; color:blue; } </style> <div> <h4>International News</h4> <article> <h4 class="headline">New Developments</h4> <aside> <h4>Impact on Markets</h4> </aside> </article> </div> </html> My question is: Why is the text, "Impact on Markets" in blue and not yellow?
6 Answers
+ 3
"article h4" applies to all h4 elements.
Change it to "article > h4" so it only applies to elements directly below
+ 2
Because "New Developments" is not inside "aside" element
0
Thanks for the answer, but if "article h4" overwrites "aside h4" because of the order in the css, then why is "New Developments" orange and not purple?
0
Yes, but it is inside "article" element, which should be purple and is described after ".headline" in the css
0
Question: Why is "New Developments" orange and not purple?
<!doctype html>
<style>
.headline{
color:orange;
}
article{
color:purple;
font-style: normal;
}
</style>
<div>
<article>
<h4 class="headline">New Developments</h4>
</article>
</div>
</html>