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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS link styling problem 1

Status
Not open for further replies.

Geates

Programmer
Aug 25, 2009
1,566
US
Given:
Code:
<html>

<style type="text/css">
a {
	font-size: 14px;
}

a .small {
	font-size: 8px;
}
</style>

<a href="something">Something</a>
<a href="something" class="small">Something</a>

</html>

One would expect the second link to have a .small styling. However, this does not seem to be the case. Can anyone explain what I'm not considering?


-Geates


"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi

Geates said:
One would expect the second link to have a .small styling.
Nope. That is not what you defined there.

Your [tt]font-size: 8px;[/tt] will be applied to any element with class .small that is descendent of an element [tt]a[/tt].

You would like this ( note the absence of any whitespace characters between [tt]a[/tt] and .small ) :
CSS:
a[teal].small[/teal] [teal]{[/teal]
    [COLOR=coral]font-size:[/color] [COLOR=darkgoldenrod]8px[/color];
[teal]}[/teal]
See Cascading Style Sheets Level 2 | Selectors for details.


Feherke.
 
Ah, of course! Thanks Feherke!

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top