I have made a simple fragment of html, which contains this:
<a href="#"><div>Something here</div></a>
It obviously alert me that div cannot be inside an <a>
tag. I have used a div, because I want the whole box (div in this case) to be a button. So the subclass :hover
and a proper button area applies to the whole box, not only a text inside. As far as I remember divs can be used inside tags in html5. I use XHTML 1.0 Transitional. Is there anything I can replace a div with to avoid errors in the code? or should I change xhtml to html5? will it work good without touching the rest of the code? thank you.
!DOCTYPE html
for HTML5 or stay with the XHTML doctype and wrap the content of thediv
witha
, while giving it adisplay: block
CSS property. Removing thediv
wouldn't hurt either in the second case, unless it serves some other purpose too.