Forum Moderators: not2easy
<div id="menu">
<a href="example.com"><div>Examples</div></a>
</div>
I wanted it that way so that the whole div would change color instead of just the anchor's little box, and of course I couldn't use javascript to do it with an onmouseover because if the agent executes javascript then, well, the other menu will be in place.
My theory was that if an anchor can enclose an image, why not a div, but I really didn't expect it to work.
It does work in FF, but not in IE6. FF is, however, insisting on underlining the text.
As I type this it occurs to me that I can just make the anchor itself bigger and bordered so I'll do that, but I'm still curious. Do you think it's legitimate and IE6 is yet again not playing nice, or did FF just sort of accidentally do what I intended?
I'm not sure what you're trying to accomplish but try something like this:
div.navmenu a {
display: block;
text-decoration: none;
}
div.navmenu a:hover {
background-color: #a32e20;
text-decoration: none;
}
That will change the entire background of the <div>, not just the <a> box. If that's what you want then just add the additional <a> styles.
So I don't need to know how to fix a problem, all I want to know, for edification, is
<a href="example.com"><div>examples</div></a>
valid or not? Actually put that way I guess it stopped being a CSS question and is now an html/browser question.
That will change the entire background of the <div>, not just the <a> box.