Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I'm using Css a:focus and it does not work. This is the code :

Css:
CSS
 #nav {
    
font-family:  "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
float:left;
position:absolute;
left:0px;
top:140px;
width:100%;
margin:5px;
padding:5px;
background-color:#DDDDDD;
}

#nav li {
display:inline;
padding:0;
margin:0;
}

#nav a:link,
#nav a:visited {
color:#555454;
width: 75px;
height: 22px;
float:left;
background:url('12.png') no-repeat;
padding:5px 0px 0px 30px;
}

#nav a:hover{
background:url('11.png') no-repeat;
border:2px solid red;
}

#nav a:active {color: orange;}

#nav a:focus {color: red;}


HTML
<ul id="nav">
<li><a href="/" tabindex="1">home</a></li>
<li><a href="http://google.com">explore</a></li>
</ul>


The problem is that a:focus is not working at all. When I'm on the homepage, the first link has no focus properties specified in CSS.

Any ideas?
Posted

1 solution

http://jsfiddle.net/uuyNH/1/[^]
I've tested your markup and made some changes to the style.
CSS
#nav li a:active, #nav li a:focus:active { color: orange; }
#nav li a:focus{ color: red; }

I hope that's what you were looking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900