March 6, 200818 yr I am having a problem linking two sets of type on a page. I have 2 CSS pages attached to the htm page. One set of links is on a dark background, the other links are on a light background. The links on the light background are turning white but I want them to be dark blue. I thought that if I have two separate a:link and a:visited in the separate CSS pages, that this wouldn’t happen. Anyone have any answers before I pull my hair out!? Thanks a mil.
March 7, 200818 yr I am having a problem linking two sets of type on a page. I have 2 CSS pages attached to the htm page. One set of links is on a dark background, the other links are on a light background. The links on the light background are turning white but I want them to be dark blue. I thought that if I have two separate a:link and a:visited in the separate CSS pages, that this wouldn’t happen. Anyone have any answers before I pull my hair out!? Thanks a mil. If both CSS files are being called, it'll use the last style specified for the selector. Are the two CSS files simply alternative stylesheets for the same html page?
March 7, 200818 yr you could always set the link to have a class if you want it to be different like this: HTML: <a href="#" class="one">one link</a> <a href="#" class=" two">two link</a> CSS: a.one { color:#CC0099} a.one:hover { color:#3300CC} a.two { color:#CCFF00; text-decoration: none;} a.two:hover { color:#FF0000}
March 9, 200818 yr Author If both CSS files are being called, it'll use the last style specified for the selector. Are the two CSS files simply alternative stylesheets for the same html page? Yes that’s right..it’s for the same html page. Thanks for your help.
March 9, 200818 yr Author you could always set the link to have a class if you want it to be differentlike this: HTML: <a href="#" class="one">one link</a> <a href="#" class=" two">two link</a> CSS: a.one { color:#CC0099} a.one:hover { color:#3300CC} a.two { color:#CCFF00; text-decoration: none;} a.two:hover { color:#FF0000} I will try this and see if it works. Thanks. Will let you know!
March 9, 200818 yr Author I will try this and see if it works. Thanks. Will let you know! It’s probably easier if you see the document and its CSS file so go here: http://www.enlightenedoils.net/linkstest.htm Here is the CSS page: http://www.enlightenedoils.net/links.css As you can see, the links in the center of the page are taking on the colors of the bottom bar. I don’ t want that. I want to make them different colors for the links. Where do I insert the code in my documents? Thanks so much! 4silverstrea
March 9, 200818 yr Hi There, What Dizi has posted is exactly what you need to do. You have two different types of links, so you need to define them to be different. If you want the ones in the center of the page to be a different colour then you need to add a class to them: As per Dizi's HTML: <a href="#" class="one">one link</a> <a href="#" class="two">two link</a> Look at the a tag, you can see there is an extra attribute compared to what you have, this attribute is called "class" and it allows you to create a separate style for that link. So links with class="one" will all look the same, links with class="two" will all look the same, and links without any class at all will all look the same. Now to change what each class looks like you need to define the classes in your css a.one { color:#CC0099} a.one:hover { color:#3300CC} a.two { color:#CCFF00; text-decoration: none;} a.two:hover { color:#FF0000} Look carefully and you will see that both the standard and the hover colour has been set for both classes one and two. You do this by first calling the tag that has the class, in this case "a", and then putting the class name but starting with a "." so a.one and a.two You can omit the a if you want. In Dizi's example a.one has been given the colour #CC0099 (bright pink) and a.two has been given the colour #CCFF00 (bright green). In your HTML file you need to choose which links you want to display differently (so the center links) and add a class attribute you all of them, for example class="centerlinks" then in your css you need to define what they look like so a.centerlinks { }. This will do what you want. In your HTML file you need to clear up all of your styles, you have several styles defined in the HTML in <style> tags at the top, these need to be placed in your css file. Also you have defined two different css files, you only need the one as defining different styles in different documents will not help you, you need to use classes as above. - Eris
March 9, 200818 yr Author Hi There, What Dizi has posted is exactly what you need to do. You have two different types of links, so you need to define them to be different. If you want the ones in the center of the page to be a different colour then you need to add a class to them: As per Dizi's HTML: <a href="#" class="one">one link</a> <a href="#" class="two">two link</a> Look at the a tag, you can see there is an extra attribute compared to what you have, this attribute is called "class" and it allows you to create a separate style for that link. So links with class="one" will all look the same, links with class="two" will all look the same, and links without any class at all will all look the same. Now to change what each class looks like you need to define the classes in your css a.one { color:#CC0099} a.one:hover { color:#3300CC} a.two { color:#CCFF00; text-decoration: none;} a.two:hover { color:#FF0000} Look carefully and you will see that both the standard and the hover colour has been set for both classes one and two. You do this by first calling the tag that has the class, in this case "a", and then putting the class name but starting with a "." so a.one and a.two You can omit the a if you want. In Dizi's example a.one has been given the colour #CC0099 (bright pink) and a.two has been given the colour #CCFF00 (bright green). In your HTML file you need to choose which links you want to display differently (so the center links) and add a class attribute you all of them, for example class="centerlinks" then in your css you need to define what they look like so a.centerlinks { }. This will do what you want. In your HTML file you need to clear up all of your styles, you have several styles defined in the HTML in <style> tags at the top, these need to be placed in your css file. Also you have defined two different css files, you only need the one as defining different styles in different documents will not help you, you need to use classes as above. - Eris So where do put this on the HTML page, above the two href links under style? </style> <link href="links.css" rel="stylesheet" type="text/css"> <link href="btmmenulinks.css" rel="stylesheet" type="text/css">
March 9, 200818 yr Get rid of your btmmenulinks.css and the class="btmmenulinks.css" in your <th>. You do not need to define an entire new style sheet for a class. You need to put the class name code into your links...inside the individual <a> tags as it is shown in the post. The styling goes into the one stylesheet that you keep i.e. inside links.css
March 10, 200818 yr Author Get rid of your btmmenulinks.css and the class="btmmenulinks.css" in your <th>. You do not need to define an entire new style sheet for a class. You need to put the class name code into your links...inside the individual <a> tags as it is shown in the post. The styling goes into the one stylesheet that you keep i.e. inside links.css Thanks Eris. This makes sense.By the way, I love your signature quotes! 4silverstrea
Create an account or sign in to comment