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
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  ;)
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now