Results 1 to 8 of 8

Thread: CSS Menu Question

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question CSS Menu Question

    Hi Everybody.

    I have a question about links in a CSS menu.
    I thought that when I change the font color for active link, then the active link color is that after clicked on that link the new page opens and then the link that just was clicked shows a different color as it is active in this moment.
    But thats not the case.
    It just shows the active link color for a brief moment like on mousedown.
    Is there a way that the link that was clicked after the new page is there that this link shows a different color?
    Sorry but I don' know how to explain it better than this, because of my limited english.

    Thanks in advance.
    Cheng

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    a:visited is what you need.

    you can set up your CSS like:

    Code:
    a:, a:visited{ color:#FF0000}
    For example, and the active state (when being pressed), and the visited state (after being pressed) will be red.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Post

    Hi BLIZZaRD.

    Thanks a lot for the reply.
    I think that's it what I'm looking for and will apply it right now.

    Thanks again very much.
    Cheng

  4. #4
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question

    Hi BLiZZaRD.

    One more thing.
    Now it is working but when I click another link then I have two links with this color and so on.
    Is it possible that just the link that was last clicked shows in a different color and not all of them that has been clicked before that?
    Below the CSS for the menu I'm using.

    Thanks again.
    Cheng

    CSS:
    Code:
    #menu {
    
    } 
    #menu ul {
    	list-style-type: none;
    	padding: 0;
    	margin-left: 0;
    } 
    #menu li {
    	color : #000066;
    	background-color: #000000;
    	background-repeat: no-repeat;
    	background-position: left center;
    } 
    #menu li a {
    	color : #FFCC00;
    	text-decoration : none;
    	font-family : Verdana, Arial, Helvetica, sans-serif;
    	font-size : 11px;
    	text-align : left;
    	width : 130px;
    	height : 30px;
    	text-indent : 40px;
    	display : block;
    	line-height: 30px;
    	background-color: #000000;
    	background-image: url(../Images/Buttons/1.png);
    	background-repeat: no-repeat;
    	background-position: left center;
    	font-weight: bold;
    } 
    #menu li a:hover {
    	color : #FFFF00;
    	font-size : 11px;
    	font-family : Verdana, Arial, Helvetica, sans-serif;
    	text-align: left;
    	display: block;
    	background-color: #000000;
    	text-indent: 40px;
    	font-weight: bold;
    	background-image: url(../Images/Buttons/3.png);
    	line-height: 30px;
    }  
    #menu li a:active {
    	color: #00FFFF;
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 11px;
    	font-weight: bold;
    	text-decoration: none;
    	background-color: #000000;
    }
    #menu li a:visited {
    	color: #FF0099;
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 11px;
    	font-weight: bold;
    	text-decoration: none;
    	background-color: #000000;
    }
    Cheng

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Not that way, no. At least not that I know of. That is the design of the "visited" color/image change... if the visitor has visited that link they get a visual representation of it. It is stored in cache, or cookies, or however else.

    There may be a script work around for that, but I don't know.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. #6
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    .......alright thanks.
    I will try to get a workaround javascript if possible.
    Thanks again.......
    Cheng

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I am researching some indepth CSS stuff currently, if I come accross an CSS option I will post here for you.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #8
    Join Date
    Apr 2006
    Posts
    205
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    Hi Cheng,

    I can suggest a work around but I'm not sure it's what you're looking for.

    Why don't you give the link a new class on the page that it links to?

    For example, if you have a menu like this:

    HTML Code:
    <ul id="menu">
      <li><a href="page1.html">Page 1</a>
      <li><a href="page2.html">Page 2</a>
      <li><a href="page3.html">Page 3</a>
    </ul>
    On Page 1 you could give the link to Page 1 a class, let's say, 'selected'.
    HTML Code:
    <ul id="menu">
      <li><a href="page1.html" class="selected">Page 1</a>
      <li><a href="page2.html">Page 2</a>
      <li><a href="page3.html">Page 3</a>
    </ul>
    And then on Page 2...
    HTML Code:
    <ul id="menu">
      <li><a href="page1.html">Page 1</a>
      <li><a href="page2.html" class="selected">Page 2</a>
      <li><a href="page3.html">Page 3</a>
    </ul>
    The colour of the selected link could then be defined in the CSS like this:

    Code:
    #menu a.selected {
       color: red;
    }
    I hope this helps.

    dog

Bookmarks

Posting Permissions

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