CSS on hyperlinks

Posted on 2000-04-26
Last Modified: 2013-12-25
Just out of curiosity, is it possible to color a hyperlink (or regular text) a different color than the underline?  For instance, if I had a green hyperlink like so:

<a href="somepage.html" style="color:green;text-decoration:underline;">

The link text and the underline would be green.  Could I, say, make the underline blue?  Thanks
Question by:jmtt13
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 2752069
LVL 18

Expert Comment

ID: 2756782
But what you can do is assign properties to the items in layers...

And no, I have not done it so don't ask me to do it for you...

Author Comment

ID: 2757232
Do you happen to know of a web site that might reference assigning properties in layers?  This sounds interesting.  Thanks  ;)
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

LVL 18

Expert Comment

ID: 2757258
Look into the <ilayer> and <layer> tags, in NN the link is  For IE you can use the <div> tag and z-index refs in CSS.

Expert Comment

ID: 2777791
why don't you do somehting a lot simpler and use images. Save them as gifs and they will be pathetically small.

IMHO this way is a lot simpler:-)

It does matter about the formatting tho'

Accepted Solution

nettrom earned 75 total points
ID: 2804308
The answer to your question is: in theory, yes.

You'll have to wrap the link in a SPAN though, and assign the underline color to the SPAN.  E.g:

<span class="blackLine"><a href="..."> ... </a></span>

and then:

<style type="text/css">
..blackLinke {
  text-decoration: underline;
  color: black;
  background: transparent;
..blackline a:link {
  color: red;
/* etc, etc */

You'll maybe have to add 'text-decoration: none;' to the link.

The underlining should be kept throughout the element, see for an example (although they don't use links).

Author Comment

ID: 2804887
This is just what I was looking for.  Thanks a bunch!

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question