Here is the CSS required to change the color of a link in HTML. If you are trying to figure out how to use CSS to change link color, this is the code you’ll need. This can be used either inside the HTML of your page, or in a separate CSS file.
<style type="text/css"> a:link { color: #0000ff; } a:visited { color: #00ff00; } a:hover { color: #ff0000; text-decoration: none; } a:active { color: #777777; } </style>
Ah – wish I’d seen that two weeks ago 🙂
this is great for all notepad lovers, but for those who use wysiwyg editor like dreamweaver there is such option already
Thanks stumbled over your blog looking for the css code thank you, going to spent some more time reading. bookmarked! 🙂
Great little tip. Better for SEO to put it in a separate CSS file.
My wife is learning CSS right now. This one was bugging her all last night. I’ll point her in your direction
Cool – Thanks for the tip.
Hey, it looks just like in the edit HTML section in Blogger. I never know it is so simple and easy to understand those lines. Now I remember, the color number is like the one I see in Photoshop.
Hrm, I just picked this book up at the library, and I went on the internet to see if it was any good, and it was.
Nice article!
thanks for this. It really helps me modify my theme faster. It really helps. I hope that more articles like this will be available in your site. Thanks so much.
This has been a major source of pain for me lately. Thanks for the tip!
Please come join our forum Adam, your blog is quality and really helpful and our readers would be interested in it.
thanks for this hint. 🙂
Thanks for this simple tutorial. But can you give us more tutorial that can be useful for web designing… Im really into that lately. I am looking forward for more of your examples.
I’ve always done this from within the tags, but I’m changing to CSS now, so this will be very helpful!
I have known how to use this code before, the problem is that I kept on forgetting how to do it.. LOL.. So thank you for sharing this..
Great, this is exactly what I was looking for. CSS is so useful and easy to use to create great looking and easy to maintain web pages. Cheers.
hey this is great for all notepad lovers, but for those who use wysiwyg editor like dreamweaver there is such option already
For some reason the link settings in CSS get mixed with my Explorer and Firefox automatic link settings. And when I set a color in CSS, then the Explorer or Firefox will still show a purple color link.
Its a good way to make links on the website look more appealing.
I know about hover only but now i know link active and visited.
Thank you
Thank you for this sample codes.
To Clarify i add:
a:link : Default color of each link on page
a:visited : Color of link if visited once
a:hover : Color when mouse over the link
a:active : Color when that page is active.
Thanks,
Modern Technology
I have a lot to do with HTML coding as although I deal in refurbished gaming laptops it is not all about hardware only. It is a really nice helpful tip of using CSS within HTML to change the color of the link.
This is very useful info. I am just starting to modify my CSS code and this will definitely come in handy. Thanks!
Is useful to learn the code. Many people now just use Dreamweaver etc… whilst they make life easier it’s not as good as learning the code yourself and using notepad!
CSS tips and tricks are wonderful. Always looking for useful ways to utilize the best CSS available.
Great, this is exactly what I was looking for. Very useful CSS tips
Yes, but.
I have a link in white text on a black background. I want to modify that so that it goes yellow on hover. But on the same page I have another link in blue text on a white background. If I allow that to change to yellow on hover, it’s illegible. So I need to modify that one to go red on mouseover.
How do I change one link differently to another?
Thanks for the code. Really nice and simple. I was looking for the script and found just right here. Checked at the notebook.
This Basic css code tips is nice.. I like but more standard formats are available in Style sheet ….
Link colors are puzzling me for 1 hour. I couldn’t make the unvisited link the required color. Now I know 🙂
Thank you,
John
Thanks Alots
Thanks so much! Soooooooo much help. =D