Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Onclick change menu picture

Status
Not open for further replies.
Although quite why he has used images when you can have "list-style-type: square" and put spans (or divs) inside the li elements to keep the bullet a different colour from the content I'll never understand.

If you want to do this sans images, I'd investigate that.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Although quite why he has used images [...] I'll never understand.

That's easy. There's two reasons (one good, one a necessary evil) for using bullet images to replace the default ones in a list of links.

First the evil one: You can't change the colour of the bullet on :hover with IE, because IE will only apply :hover to <a> elements - and the bullet colour is dependent on the colour of the <li>, not it's contents. Modern browsers can style li:hover.

Now the good one: Doing it this way makes the bullet clickable as well as the text. A user might interpret such a list as a vertical row of little square buttons, each with a label. Doing it this way means it can behave like one.

when I click on a link, then I want the picture to change to the active (darker picture) and the link should be gray.

Just style the [tt]:active[/tt] status then:
Code:
#navcontainer ul li a:active
{
background-image: url(images/darker.gif);
color: gray;
}

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
BillyRayPreachersSon And ChrisHunt, thanks for the help. Now it works exactly as I wanted it to do.

Many thanks

George I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top