Jump to content

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!

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...