My markup looks like:
<div class="c1">
<li class="c2"><a href="">blah</a></li>
</div>
I want the text blah to be red.
c1 is used other places, so I want to drill down as much as possible without affecting other markup.
To set the font color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property color. HTML5 do not support the <font> tag, so the CSS style is used to add font color.
To change the HTML font color with CSS, you'll use the CSS color property paired with the appropriate selector. CSS lets you use color names, RGB, hex, and HSL values to specify the color.
The <font> tag in HTML plays an important role in the web page to create an attractive and readable web page. The font tag is used to change the color, size, and style of a text.
Use this style definition in your css-file:
div.c1 li.c2 a {
color: red;
}
PS: Having your <li>
tag inside your <div>
-tag without an <ul>
-tag is not recommended.
<style>
div.c1 li.c2 a { color: red; }
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With