I still dont get it, which color will be paragraph “test1” and why?
<style>
p {
color: red;
font-style: italic;
}
</style>
<div style="color: green;!important">
<p style="color: blue;">test1</p>
<p>test2</p>
</div>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Importance does not cascade.
Even if a parent element (the
<div>) has an!importantproperty (note that it actually doesn’t, due to a syntax error), it will still be overridden by any property applied to the child element.!importantcan only override other rules that are applied to the same element.Therefore, the first
<p>will be blue, since there is nothing to override its inline style.