I have this html code
<div id="mybox"> aaaaaaa </div>
and this is my css
#mybox{ background-color:green; } #mybox:hover{ background-color:red; }
the question is how to hide the content of the div (aaaaaaa) when the mouse hover event by using css only and without changing the structure of the code I think I should put some code under #mybox:hover but I don’t know the code.
Without changing the markup or using JavaScript, you’d pretty much have to alter the text color as knut mentions, or set text-indent: -1000em;
IE6 will not read the :hover selector on anything other than an anchor element, so you will have to use something like Dean Edwards’ IE7.
Really though, you’re better off putting the text in some kind of element (like
porspanora) and setting that todisplay: none;on hover.