CSS Question - templates

MrMaster

Golden Member
Nov 16, 2001
1,235
2
76
www.pc-prime.com
Yes, my html skills need help but this problem is really bugging me.

I have a template that I use on every page. In that template, a CSS style for ALL is set that every link is white.

Well, in the body, which is a white background, means you can't see any of my links.

I can't seem to use a new style sheet or edit the color to something else? Is there a simple answer to this?

1. i want white links on black background in template.
2. i want black links on white background in body.

Thanks.
 

Titan

Golden Member
Oct 15, 1999
1,819
0
0
Where is your style sheet? In a separate file, in the head, or inline? You have 3 options here, each one overrides the previous.

The body is the whole visible page. So how is your "template" defined? If it is contained within the body, you need a CSS selector that overrides the body.
 

Aluvus

Platinum Member
Apr 27, 2006
2,913
1
0
The cleanest way to do this is to give the parent element in your navigation section (or whatever it is that is repeated on every page) a class, so that you can specifically target that section and its children. You may want to do the same for the section containing the content. For instance:

In the CSS (in the document head or preferably in an external file:

.nav a
{
color: white;
}

.content a
{
color: black;
}

And then in the HTML:

<div class="nav">Stuff goes here</div>

<div class="content">More stuff goes here</div>

Also, it is not generally a good idea to make links black unless the body text is some other, clearly different color. Links should always be easy to find at a glance.
 

Woosta

Diamond Member
Mar 23, 2008
3,006
0
71
Originally posted by: Aluvus
The cleanest way to do this is to give the parent element in your navigation section (or whatever it is that is repeated on every page) a class, so that you can specifically target that section and its children. You may want to do the same for the section containing the content. For instance:

In the CSS (in the document head or preferably in an external file:

.nav a
{
color: white;
}

.content a
{
color: black;
}

And then in the HTML:

<div class="nav">Stuff goes here</div>

<div class="content">More stuff goes here</div>

Also, it is not generally a good idea to make links black unless the body text is some other, clearly different color. Links should always be easy to find at a glance.

Though, you should be using IDs for unique sections of the page so the nav and content should not be class attribute values/classes.
 

pubicenemy

Junior Member
Jun 11, 2009
12
0
0
Along with what others have posted, organization of your content is key. You can set a base color that will be inherited by all links in the document, say if the body background is white you can set the default anchor color by declaring

a:link{color:black;}

and then if you have specific divs with colored backgrounds that you want the links to show up as white you combine selectors like

#darkbackgrounddiv a {color:white;}
 

Aluvus

Platinum Member
Apr 27, 2006
2,913
1
0
Originally posted by: Woosta

Though, you should be using IDs for unique sections of the page so the nav and content should not be class attribute values/classes.

Agree, not sure why I chose classes instead of IDs.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |