Forum Moderators: not2easy
#services_nav a {
display:block;
width:146px;
height:37px;
margin: 0;
padding: 0;
background: url(../../images/nav_services.gif) 0 -1px no-repeat;
}#services_nav a:visited {
display:block;
width:146px;
height:37px;
margin: 0;
padding: 0;
background: url(../../images/nav_services.gif) 0 -1px no-repeat;
}
#services_nav a:hover {
background-position: 0 -39px;
}
#services_nav a.active {
display:block;
width:146px;
height:37px;
margin: 0;
padding: 0;
background: url(../../images/nav_services.gif) 0 -1px no-repeat;
background-position: 0 -39px;
}
Thanks in advance
are you aware that a:active (or a:focus for IE) only works when link is clicked on (or in focus) - usually a blink and you miss it
or are you looking to make a "navigation tab" stay highlighted when the page it pertains to is open?
try this for an example of how the
:active and :focus work, you should see the red background only for a second or so after clicking the google link..
CSS:
#nav a {
display:block;
width:146px;
height:37px;
margin: 0;
padding: 0;
background: #eee;
}#nav a:visited {background: #cfc;}
#nav a:hover {background: #dad;}
#nav a:focus, #nav a:active {background: #f00;}HTML
<div id="nav"><a href="http://www.google.com">google</a><a href="#">home</a></div>
If it is the case that you would like an "active" tab to remain constant, depending on what page you're on - you either need to use a script to generate a CSS class name for the "active" link or you can use CSS body ID's combined with link classes, if you let us know which we can be more help.. there's a thread somewhere which explains how to do the latter
-Suzy
edited to add:
re: second method [webmasterworld.com]
[edited by: SuzyUK at 3:56 pm (utc) on Dec. 10, 2007]