简体   繁体   中英

Underline in a text with red color in CSS

I want to write an underline with font color red.

I Tried like this

 <u> <li style="COLOR:red"><a href="/jobs.aspx/"> Internal Job Openings </a></li></u>

But the content is hiding. How to fix this?

You need to override the default style for a as well:

<ul>
    <li style="color:red"><a style="color:red" href="#">foo</a></li>
</ul>

see the fiddle....

First of all, your HTML is invalid. You cannot enclose a <li> inside a <u> tag. And remove the <u> tag as it is deprecated. Use the CSS's color and text-decoration rules to achieve your result.

Change it to this way:

<li style="COLOR:red; text-decoration: underline;">
    <a href="/jobs.aspx/"> Internal Job Openings </a>
</li>

If you just need it for the link, then give the style to the link.

<li style="COLOR:red;">
    <a style="text-decoration: underline;" href="/jobs.aspx/"> Internal Job Openings </a>
</li>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM