troubleshooting Question

How do I use CSS to implement a button selected state?

Avatar of aspnet-scotland
aspnet-scotlandFlag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScriptCSSHTML
9 Comments1 Solution324 ViewsLast Modified:
Hi,

I have the below css on my div (id=NA_Button_Sel) which sets a background image on the set width and height of the div and a seperate image on hover (to create a button effect). How can I create a selected state so once the div is clicked a background image can be set?

#NA_Button_Sel
{
    background: url(images/nav-northamerica.gif) no-repeat;
    width: 72px;
    height: 27px;
    top:0px;
    left:0px;
}

#NA_Button_Sel:hover
{
    background: url(images/nav-northamerica_roll.gif) no-repeat;
    width: 72px;
    height: 27px;
    top:0px;
    left:0px;
    z-index:20;
}

Thanks.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros