Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-07-2007, 07:20 PM   PM User | #1
sridharr
New Coder

 
Join Date: Jul 2007
Location: Bangalore, India
Posts: 20
Thanks: 4
Thanked 1 Time in 1 Post
sridharr is an unknown quantity at this point
Single class for normal text & link / hover

I want to define a single style class with a pre-defined text color, lets say Black. But when I hyperlink a part of the text content, it should take a different property and yet another when I hover on the link.

So far, what I have is

.main_menu {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12pt;
font-weight: normal;
color: #000000;
text-transform: none;
}
.main_menu:link {
color: #CC0000;
text-decoration: none;
}
.main_menu:visited {
color: #CC0000;
text-decoration: none;
}
.main_menu:hover {
color: #0000FF;
text-decoration: none;
}


What I want is:
HomeAbout UsPortfolioContact

Here, I don't have links on the bullet, hence they should be black. Since, I am going to hyperlink "Home", "About Us", etc., I want them to be colored Red and hover with Blue.

How can I do this with just one class?

Thanx,
Sridhar
__________________
Signature Design | Development
sridharr is offline   Reply With Quote
Old 08-08-2007, 10:27 AM   PM User | #2
ronaldb66
Senior Coder

 
Join Date: Jun 2002
Location: The Netherlands, Baarn, Ut.
Posts: 4,253
Thanks: 0
Thanked 0 Times in 0 Posts
ronaldb66 is an unknown quantity at this point
Selector

Specifiy the anchor element in the selectors to single out anchors:

Code:
.main_menu a {
...
color: #F00;
...
}

.main_menu a:hover {
...
color: #00F;
...
}
etc.
__________________
Regards,
Ronald.
ronaldvanderwijden.com
ronaldb66 is offline   Reply With Quote
Old 08-08-2007, 06:38 PM   PM User | #3
sridharr
New Coder

 
Join Date: Jul 2007
Location: Bangalore, India
Posts: 20
Thanks: 4
Thanked 1 Time in 1 Post
sridharr is an unknown quantity at this point
Thanx Ronald. It works.

Sridhar
__________________
Signature Design | Development
sridharr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:51 PM.


Advertisement
Log in to turn off these ads.