Question:
Links colors on stylesheet aren't working right!?!?
Tyler
2008-09-16 16:49:17 UTC
Sooo...
I'm working with my stylesheet for my website
and this is how my link codes are that aren't working:

a {
color: #6d94b5;
text-decoration: none;
font-weight: bold;
}

a:hover {
color: #976db5;
text-decoration: none;
}


And the colors i put for those links aren't working and the boldness isn't showing up
i don't know what i did wrong?!
can someone help?
Four answers:
2008-09-16 17:34:40 UTC
Actually, if your hyperlinks appear as an element BEFORE another element, and the other element is styled a certain way, the newer element will override your hyperlink styles.



For example, suppose these two styles:



p {

font-weight: normal;

color: #000;

}



a {

font-weight: bold;

text-decoration: none;

color: #f00;

}



Now suppose this HTML:



Hello World!





In that case, the style you assigned to the a element should show.



However, if you do this:



Hello World!





The styles for p override the styles for a; the underline won't show, but the text will not be bold and it will be black.



Check the order of your elements and make sure the a elements appear as the last element before the text you are linking.
ArunS
2008-09-17 00:06:35 UTC
You need to make sure no other css styles are overriding your link styles. For example:



#content {

color: #000;

font-weight: normal;

}







The solution would be:



#content a {

color: #6d94b5;

text-decoration: none;

font-weight: bold;

}



... or use classes instead of ids like:



.content {

color: #000;

font-weight: normal;

}







I would strongly recommend using Firefox with the Firebug add-on which will allow you to debug these type of css problems far more easily.
a_kewl_fisherman
2008-09-16 23:57:40 UTC
try



a:link {

color: #6d94b5;

text-decoration: none;

font-weight: bold;

}
seanaleo
2008-09-17 00:33:03 UTC
The code that you post works correctly, unfortunately. There are many possibility that it still will not work. I will just randomly list some:



- you did not declare your css correctly in your html file.

- there are other "a" tag style that overwrite your specification.

- there are more than one css file and they overwrite your code.



I hope that helps....


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...