views:

83

answers:

2

Hey guys I'm currently having trouble with my CSS linking. Basically I want the colour of my links to change when I hover over them, and click on them and such. But for some reason it is not working when I view it on a browser. Below is my HTML code and my CSS code, they are seperate files and are linked togather. Thanks in advance. (I apologise if the codes are not appearing correctly but it is all there)

EDIT: Don't worry its fixed now :D thanks for the help

A: 

from what I see, you don't have a:hover,a:vistied, or a:active defined anywhere, which is what controls the behavior you're looking for.

GSto
it is under the "menu {" but for some reason it is appearing all togather, in my CSS they have there own seperate lines.
A: 

Are you coding by hand or using Dreamweaver as a WYSIWYG?


NOTE: This could be because the files aren't formatted well in your question, so Markdown could have dropped some characters from the display.

From what I can see, the CSS file isn't written correctly. I'm going to give one example for you which fits for the whole file:

content {
    width: 510px;
    float: left;
}

This snippet above looks for the <content> tag in the HTML, and when it finds that tag, it will give it a width of 510px and floats it to the left. The problem here is that there are no <content> tags in your HTML page OR in HTML 4.01 itself. What you need to do is change it to this:

.content {
    width: 510px;
    float: left;
}

By adding the '.' before 'content' in the CSS, it changes 'content' from <content> to finding a tag that has class="content" as an attribute.


Also, to get the <a> tags to change on hover, etc, use the pseudo-elements (pseudo-attributes?) of :hover, :active, and :visited, for when a user hovers over a link, clicks on a link, and has previously visited a link, respectively.

Example:

a {
    color: blue;
}

a:hover {
    color: red;
}

In this example, a link will display as blue unless the user has their mouse on the link.

Jeff Rupert