I am trying to make a menu where I show the icon and when i hover over the icon the text will appear. I've got that so far, but I want to change the background color of the text.
<div id='menu'>
<div id='menuitems'>
<div class="item" onclick="loadPage('/')">
<span class="menuIcon"><img src='/img/layout/icons/home.png'/></span>
</div>
<div class="item" onclick="loadPage('/pages/settings/')">
<span class="menuIcon"><img src='/img/layout/icons/settings.png' /></span>
</div>
<div class="item" onclick="loadPage('/pages/php/')">
<span class='TextMenuItem'>< / ></span>
</div>
</div>
<div id="menuText">
<div class="itemtext" onclick="loadPage('/pages/home/')">Home</div>
<div class="itemtext" onclick="loadPage('/pages/settings/')">Settings</div>
<div class="itemtext" onclick="loadPage('/pages/php/')">Projects</div>
</div>
</div>
So if I move over a div with the class item
I want to change the color of the div and the div with the class itemtext
. Is it possible, in css, to see how many times a class has been used before the one that I hover and based on that number being able to color the background of the itemtext
div with the same number or do I have to use javascript?
JSFiddle with progress: http://jsfiddle.net/WszKV/