Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Links

  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Links

    Hi,

    This has been a big problem for me in the past and now again.

    The problem is with the visited links. I want my links to act the same as most portals. By default it turns purple and underlined, I don't want that. I used to use Wordpress for a blog and when you clicked on a link, the link would remain "unvisited" and still use the a:link.

    I find these things hard to explain, sorry.

    Thanks.

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    add this CSS code to your document or your stylesheet (don't know if you have a stylesheet with wordpress)

    CSS
    Code:
    a:visited
    {
    color:#COLOR YOU WANT;
    }
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Jan 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply, but that's not quite what I want.

    I don't want the visited parameter in there at all, I don't want the visited parameter to exist on my pages.

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    What's wrong with the visited parameter?

    You could give it exactly the same definitions as the a:link, and no one would no the difference

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    New Coder
    Join Date
    Jan 2004
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, thank you. I just done a little test experimenting and I've learnt that it matters what order you put the parameters, hehe.

    This is what I have now:

    Code:
    a:link {
    	color: #004784
    	text-decoration: underline;
    }
    
    a:visited {
    	color: #004784;
    	text-decoration: underline;
    }
    
    a:hover {
    	text-decoration: none;
    }
    It works great, thank you.

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    No problem. Sorry I didn't mention about the order, it didn't occur to me to do so. Just as a note, if you ever use a:active, it must go after hover.

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #7
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,372
    Thanks
    32
    Thanked 286 Times in 280 Posts
    Quote Originally Posted by Demon View Post
    Code:
    a:link {
    	color: #004784
    	text-decoration: underline;
    }
    
    a:visited {
    	color: #004784;
    	text-decoration: underline;
    }
    
    a:hover {
    	text-decoration: none;
    }
    Since the unvisited and visited states are going to be identical, you can reduce the amount of code required by combining the two rule sets. Example:

    Code:
    a:link, a:visited {
      color: #004784;
      text-decoration: underline;
      }
    a:hover {
      text-decoration: none;
      }
    Or, you could reduce things even further by targeting only the anchor element and not a specific pseudo‐class (:link and :visited are pseudo‐classes). Doing so should override the browser’s default styles for ALL states, effectively setting them for both :link and :visited. Thus:

    Code:
    a {
      color: #004784;
      text-decoration: underline;
      }
    a:hover {
      text-decoration: none;
      }
    In the above example, using the simple selector a sets styles for the :link, :visited, :hover, :focus, and :active states simultaneously. The rule set following it, overrides the text-decoration style for the :hover state (implicitly) set by the previous rule set.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •