CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 7th, 2002, 03:07 PM
bamaster bamaster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Houston, TX, US
Posts: 75 bamaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 49 sec
Reputation Power: 7
CSS > Inheriting Style

I'm struggling to understand how styles are inherited. My problem is this... I want to have more than one style for anchor tags, but am not successful in doing so. Here is what is in my stlye sheet...

Code:
A:link {
		font-family: Tahoma, Verdana, sans-serif;
		font-size: 11px;
		color: #336699;
		}

A:visited {
		font-family: Tahoma, Verdana, sans-serif;
		font-size: 11px;
		color: #6699CC;
		}

A:hover {
		font-family: Tahoma, Verdana, sans-serif;
		font-size: 11px;
		color: #003366;
		}

.second_style {	
		font-family: Tahoma, Verdana, sans-serif;
		font-size: 15px;
		color: #0000FF;
		font-weight: bold;
		text-decoration: none;
		}


This causes EVERY linkable text have these attributes. However, when I want to have a different style, and assign it a different CLASS, it no workee. Like this:

Code:
<A HREF="yada.htm" CLASS="second_style">Text Here</A>


Still, the style has the global anchor style. What am I doing wrong? I've even tried an inline SPAN style inside the anchor tag, without success.

Thanks in advance!
__________________
Tony Melendez
tony dizat amerigo dizot com
http://www.amerigo.com

Last edited by bamaster : January 7th, 2002 at 03:18 PM.

Reply With Quote
  #2  
Old January 7th, 2002, 03:45 PM
xamichee xamichee is offline
Bringer of the Bling
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Orlando, FL
Posts: 68 xamichee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to xamichee
Psuedo classes have a higher precedence than regular classes.

In your case,

a:link is a psuedoclass and .second_style is a regular class.
so a:link overrides .second_style.


You can fix this by using a generic anchor style like:

A {
font-family: Tahoma, Verdana, sans-serif;
font-size: 11px;
color: #336699;
}
(this is basically the same thing as A:link anyway so I would do it this way)
or by making the second_style class apply solely to the anchor element with

A.second_style {
font-family: Tahoma, Verdana, sans-serif;
font-size: 15px;
color: #0000FF;
font-weight: bold;
text-decoration: none;
}

Reply With Quote
  #3  
Old January 7th, 2002, 03:59 PM
bamaster bamaster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Houston, TX, US
Posts: 75 bamaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 49 sec
Reputation Power: 7
Thank you. I was not aware of Pseudo Classes. Good to know. I will make those edits.

Followup question:
within "A.second_style{}", is it possible to assign Hover and Visited attributes?

Thanks again!

Reply With Quote
  #4  
Old January 7th, 2002, 04:19 PM
bamaster bamaster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Houston, TX, US
Posts: 75 bamaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 49 sec
Reputation Power: 7
I've kinda answered my own question, heh. I just kept the Pseudo Class but only with the hover properties...

Code:
A:link {
		color: #336699;
		}

A:visited {
		color: #6699CC;
		}

A:hover {
		color: #003366;
		}
	
.second_style {	
		font-family: Tahoma, Verdana, sans-serif;
		font-size: 13px;
		color: #336699;
		font-weight: bold;
		text-decoration: none;
		}


Works like a charm!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS > Inheriting Style


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway