Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 28

Thread: a:visited

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    28
    Member #
    18189
    Hey guys i'm not sure if this is a problem but it is troubling me anyway.

    So i've started my website and i'm pretty happy with the template even though i don't fully understand it :P

    My concern is with my navbar. You will notice that when the site first loads the links are black and change to white when you hover over them. Now when i change the properties for a:visited the links stop changing colour when i hover over them.

    Is this just so that you know which links you've already visited or is there a way to keep the visited links exactly the same as they were before they were visited?

    the website is http://www.ironcladinvestments.com.au

    thankyou!

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    It's sort of a browser thing.
    You don't have to use a:visited if you don't want to.

    The browser keeps track of the pages you already viewed and uses that property.
    If you close your browser and return, those visited links will most likely be reset.

    You didn't post this in the PHP section, so I'm not really assuming you know PHP,
    but remember that PHP scripting (as in dynamic page generation) is the way to go.

    If you use PHP to monitor which page the user is viewing, you can actually alter
    the navbar properties based on the page they are viewing ... example, the current
    tab can be highlighted for the page they are viewing.

    In fact, you have one PHP script that handles your navbar, and all pages use the
    same PHP script. To add a nav items means you only change 1 file, not all of the
    other pages. Dynamic design is the way to do it.


  4. #3
    Senior Member jyuill's Avatar
    Join Date
    Jan 2009
    Location
    California
    Posts
    145
    Member #
    18049
    When styling links, they have to be done in this order:
    a:link, a:visited, a:hover, a:active. You don't have to specify a:active, but anyway the way most people learn it is LoVe HAte. You have your a:visited styled after your a:hover. Because of the cascade, the browser sees that the link should be black after it sees that it should change color on hover, and it stays black.
    Semantic, Valid, and Accessible Design!


  5. #4
    Senior Member jyuill's Avatar
    Join Date
    Jan 2009
    Location
    California
    Posts
    145
    Member #
    18049
    Quote Originally Posted by jyuill
    .You don't have to specify a:active
    Well you don't really have to do any of them if you don't want to but to do a:visited or a: hover, you first have to specify a:link instead of just a. Make sense?
    Semantic, Valid, and Accessible Design!


  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    J,
    I was sort of getting the sense that he/she was fishing for a way to highlight the
    tabs for a particular page. They then realized that even when they were on a
    different page, the previously visited tabs were different. That's what led me on the
    road about PHP ... I hope Durnatz can clarify what the real issue is.


  7. #6
    Senior Member jyuill's Avatar
    Join Date
    Jan 2009
    Location
    California
    Posts
    145
    Member #
    18049
    Well after reading the initial post more closely, I think s/he doesn't want the visited links to have a different color. If that's the case, style a:visited with the same color as a:link. If you want to style the link of the page you are on differently, then you give (and this would be where PHP would be easier but I don't know how to do that yet) have to style the link in your navigation menu to the page you are on as something like
    <a class="active" href="index.html">home</a>
    and then in your stylesheet
    a.active:link, a.active:hover {color: #fff;}
    Then the color will be the same and won't change on hover, giving the user a clue that this is the page they are on. The thing that sucks about this and what mlseim was talking about is you have to go into every page and give that page's link a class of active. Not to bad if you only have a few pages, but if you have a large site with 10+ pages, it gets very tedious and more likely you will make a mistake. But with PHP, you don't have to do that, I just don't know how!
    Semantic, Valid, and Accessible Design!


  8. #7
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    Once again, this post is not in the PHP section of the forum, but I'll post this anyhow ...

    Most people shy away from PHP because it's something they don't understand or
    have experience with. But also because you can't view your web pages offline, unless
    you have your own server.

    But for those that want to work with PHP, use Notepad, Wordpad or Dreamweaver
    text edit mode to edit pages, then upload them, and view your pages online to see
    the results.

    Use the combination of editing on your PC, uploading, and viewing online to create pages.

    ========

    Now the part about PHP ...

    Most webhosts allow PHP scripting. They specifically mention that the file extensions
    need to be .php instead of .html (or .htm). If you know how to use the .htaccess
    file, or a settings on your webhost's control panel, you can specify that ALL .html and
    .htm files be processed as PHP scripts. That means you can do PHP scripting in any
    of your .html files without changing any file extensions.

    Once you have PHP wrapped around your finger, here's the magic ...

    You take the navigation section out of your page and save it as a separate file,
    perhaps you can call it "nav.php".

    On every page that uses that navigation code, you enter:
    <?php include("nav.php");?> exactly where you want it to appear.

    Now, each page uses the same file (or script). If you change a link in the "nav.php" file,
    it will appear across all of your other 100 pages (or whatever you have).

    Or, this example ...

    On the bottom of every page, you use this for your site copyright:
    &copy;<?=date("Y")?> All Rights Reserved

    Now, it will always show the current year ... you'll never have to edit it next year.

    And finally ... the real PHP advantage ...

    If you have a bunch of text files, say for example a dozen cookie recipes, and you
    call them, cookie1.txt, cookie2.txt, cookie3.txt ....

    You can display them on any page, by using the PHP Include ...
    <?php include("cookie1.txt");?>

    With more scripting, that number 1,2 or 3 can be changed dynamically to
    display different recipes ... but that's another topic.

    =====================

    Post questions about PHP in the PHP section of this forum.
    I just wanted to infect all of the newbies with the PHP bug ....


  9. #8
    Senior Member jyuill's Avatar
    Join Date
    Jan 2009
    Location
    California
    Posts
    145
    Member #
    18049
    You rock! Thanks. I am taking PHP but haven't gotten very far yet, and really want to learn how to use it! Once I learn more, I will probably start posting questions in the PHP section. Since I don't know everything it can do yet, I can't really ask specific questions. Poor durantz...we stole his/her discussion thread! But you can learn from this too!
    Semantic, Valid, and Accessible Design!


  10. #9
    Junior Member
    Join Date
    Jan 2009
    Posts
    28
    Member #
    18189
    ok i've just woken up and seen all these posts! thanks for showing such interest here.

    I haven't had time to read in detail what you've said or try it but i just wanted to say thanks.

    You've raised another quesiton which has been burning thorugh my mind. there are a number of different "languages" to learn when designing webpages. I was trying to learn CSS and HTML first then move onto the other ones. Is this the best way or should i be learning all of them at the same time?

    just to clarify the problem was that I didn't like it how the a:visited stopped my links from hovering after they had been visited. If i didn't specify a:visited it went to the default a:visited {color: blue; text-decoration: underlined;} that looked really bad so I put in my own to try and keep it the same but it still cancels out the hover part.

    PHP sounds like it would solve this problem if I understand correctly what you said... it enables the navbar to stay exactly the same each time a new page is loaded?

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    PHP allows you to change a particular tab depending on what page
    they are viewing. In your case, maybe you want the tab on the
    "About Us" page to appear on the top or highlighted when they are
    viewing that page.

    PHP also allows the content to change automatically when different pages
    are viewed ... that means you don't create any more web pages, you only
    create text files that are inserted into a "template".

    This website is an example of a PHP script that dynamically creates every
    page you see... data is taken from a MySQL database and the PHP puts
    it all together for you to see. There are no "static" web pages, its all
    done with programming.

    For your a:visited issue, just make the properties the same as
    the normal link, don't do anything different and it will look the same.



Page 1 of 3 1 2 3 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:25 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com