aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes changing link color for just one part of a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "changing link color for just one part of a page" Watch "changing link color for just one part of a page" New topic
Author

changing link color for just one part of a page

Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I've been banging my head over this for a few days, and I thought I'd ask the wizards in here.
I currently have a site style where chunks of text are often headed by a dark background bar with white text. The body of the page is mostly black text on a white or light grey background. This works fine until I want a link in the text on the bar. Then it ignores the white text color and uses the regular blue/purple, which looks horrible and illegible. I know how to set the link style color for the whole page, but so far I haven't found a way of setting it just for one part of the page.
Here's what I do at the moment (with excess junk removed):
site.css:

index.html:

Any suggestions what I can do in the style file to ensure that links in the dark header bars appear white like the regular text?
Many thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Read this:
http://xbiz.com/articles/print.php?article_idp=612
Eric
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Thanks Eric. That was interesting, but not quite what I wanted. In the end I found another tutorial which pointed out that you can limit style changes to an arbitrary hierarchy of elements using " " (space) as a separator. So I added

to my style file, and now all links (visited and unvisited) in an area of class "divider" appear as white. I knew there had to be a way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: changing link color for just one part of a page