How do I override a child css-property. Example, the text should be black:
<div style="color: Black;">
<div style="color: Red;">Red text that should be black.</div>
</开发者_运维问答div>
Since I got some answers that suggest that I should not use inline styles, I should tell you that this is not an option, at least not for the inner div.
don't use inline styles. control them from your CSS in the tags or CSS file. Then you can use inheritance, specificty and !important to override. You can't do it with inline styles as you have it in your code.
You should use css classes and ids and use internal or external stylesheets do not use inline style for anything as far as possible. As far as making the text black you cant do it because you have it inline and that has preference over all and will be applied last. It is usually follows this order so the styles are applied starting from left to right-
External Stylesheet -> Internal Stylesheet -> Inline Styling
Look here to know more information on how to use stylesheets.
精彩评论