- This topic is empty.
-
AuthorPosts
-
December 12, 2012 at 11:44 am #41298phatzisMember
hi everyone,
i try to create a menu when you are over menu button in another div in the page the bg color change.
this is the Html code
iconAnd here is the css i dont give you the whole menu
#icon{float:right; width:200px; height:100px;}
nav ul { list-style: none; margin: 0 0 5px 0;
font-family:”Courier”, “New Courier”, “Monospace”, Helvetica, Arial, “Lucida Grande”, sans-serif; font-weight:bolder;}nav li { text-decoration:none; overflow: visible !important; font-size: 14px;
font-style:bold; width: 230px; display: block; color: black;
position: relative; left: 0px; text-indent: 15px;
font-family:”Courier”, “New Courier”, “Monospace”, Helvetica, Arial, “Lucida Grande”, sans-serif; font-weight:bolder;
text-transform:uppercase;}nav li a {text-decoration:none; overflow: visible !important; font-size: 14px;
font-style:bold; width: 230px; display: block; color: black;
position: relative; left: 0px; text-indent: 15px;
font-family:”Courier”, “New Courier”, “Monospace”, Helvetica, Arial, “Lucida Grande”, sans-serif; font-weight:bolder;
text-transform:uppercase;}nav li a:hover{ text-decoration: none; color: white; background-color:black; }
nav li a:hover span{ background-color: black; color: white; }#div1:hover ~ #icon{
background: blue;
}Any idea why its not working inside list? i have tried it and working without a list but i have to use list for this.
December 12, 2012 at 11:58 am #117007Paulie_DMemberDecember 12, 2012 at 12:02 pm #117008phatzisMembersure can remove the div
and sure i could use this code in css
nav li a:hover ~ #icon{
background: blue;
}but the problem is that dosent work with list items
December 12, 2012 at 12:04 pm #117010phatzisMemberthis is an example that works with divs but not with lists
[Your text to link here…](http://jsfiddle.net/6BfR6/94/ “example”)December 12, 2012 at 12:05 pm #117011Paulie_DMemberI’m not sure what you are trying to do.
You’re trying to change the background color of your #icon div when a particular list item/link is hovered…is that right?
December 12, 2012 at 12:21 pm #117012phatzisMemberyes exactly
December 12, 2012 at 2:28 pm #117032Paulie_DMemberGiven the structure you are proposing, I don’t think it’s possible with CSS as the icon div is not ‘related’ to the list item or the anchor.
December 12, 2012 at 2:31 pm #117035chrisburtonParticipantIf anything, use a span not a div.
December 12, 2012 at 2:35 pm #117036AnonymousInactiveThis looks like a job for jQuery!
Also I agree with Chris here, use a span instead inside the list item.
December 12, 2012 at 3:08 pm #117042phatzisMemberi have tried also with span not wornking also i give a shot to jquery
December 12, 2012 at 3:25 pm #117047chrisburtonParticipantWhat I would do is give the body a unique class for each anchor to trigger. Then, apply the bg color in CSS.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.