Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 sets of css a: tags 3

Status
Not open for further replies.

SlowFlight

Programmer
Jan 2, 2003
33
US
I have a series of web pages in which I have links in a column on one side of each page. The fonts size of these links needs to be smaller than other links on the rest of the page. How can I do that in a style sheet? I'd rather not add styles to the html pages. I am referring to a:active, a:visited etc... tags in the .css file. I have defined a set of tags in the .css file for one set of links. Can I define another set of tags in the .css file for the links on the rest of the page? If so... How?

Skip Meisch
 

To change all A tags (and their pseudo-classes), you'd use:

Code:
A:link		{ xx }
A:visited	{ xx }
A:hover		{ xx }
A:active	{ xx }

To only affect certain links, assign those links a class, say "linkStyle1", and put in your CSS:

Code:
A.linkStyle1:link		{ xx }
A.linkStyle1:visited	{ xx }
A.linkStyle1:hover		{ xx }
A.linkStyle1:active		{ xx }

Hope this helps!

Dan
 
I spoke too soon. It is now working. Many thanks!!!

Skip Meisch
 
This is rather late, but you can try without the extra classes by doing this:

.leftmenu a:link {...}
.leftmenu a:visited {...}
.leftmenu a:hover {...}
.leftmenu a:active {...}

This basically means, an <a> tag that is descendant of the leftmenu class.
 
Thanks! That's an even better method. It allows for less code in the html file to confuse me in the future.

Skip Meisch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top