Jump to content

Link colours


MarcosFM
 Share

Recommended Posts

Hi! I am reading the HTML5 tutorial from www.w3schools.com. All the examples I've tried have worked well, but not the following one: I want to change the link colours of one of my pages. The "visited", "active" and "hover" are working, but not "link", I don't know why. Could anyone help? This is what I have put in a .css file:

<style>

a:link {
    color: black; 
    background-color: transparent; 
    text-decoration: none;
}

a:visited {
    color: red;
    background-color: transparent;
    text-decoration: none;
}

a:hover {
    color: green;
    background-color: transparent;
    text-decoration: underline;
}

a:active {
    color: yellow;
    background-color: transparent;
    text-decoration: underline;
}

</style>

Thanks!

Link to comment
Share on other sites

IF in a FILE? You don't require <style> or </style>, just the file to have extension .css. The style tags are only required in pages where styling is inline and on the page itself and between the <head>...</head> tags.

Edited by dsonesuk
Link to comment
Share on other sites

Your code is fine. It works over here.

Did you try it in different browsers? I used Chrome.
Remember, if you ever visited the page, the color will be selected FROM visited, and not from link.


Delete your cookies, close your browser, or try to type a link to a website your sure you have not yet visited.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...