PDA

View Full Version : CSS Coding Help




jdl8422
Nov 20, 2007, 09:36 PM
i have my site set up and I am using an external style sheet. I have attached a photo of what I want the text to look like, but when I at the links it changes it to the default blue color that I do not want. how do I set up multiple link styles or just have a stlye that leaves links like i already have them?



rogersmj
Nov 20, 2007, 09:44 PM
You can style link behaviors with CSS pseudoclasses. For example:


a {
color: #600;
text-decoration: none;
}
a:hover {
color: #fff;
text-decoration: underline;
}


That will give you red, non-underlined links that turn white and become underlined when you hover over them. You can get more specific with a:link (default link state), a:visited (a link that the user has visited), and a:active (when a link is clicked on). Of course since all your links on your site are unlikely to behave the same way -- your navigation links might be different from inline links in posts -- you'll want to target your CSS.


#main_nav a {
color: #600;
text-decoration: none;
}


^ That targets only "a" tags inside an element with id="main_nav".