How do I make entire div a link? [duplicate]
This question already has an answer here:
- Make a div into a link 24 answers
I have a div like this
<div class="xyz"></div> and all the content in that div is in the css. How do I make that div into a link? I tried wrapping the a tag around it, but that didn't seem to work.
You need to assign
display: block; property to the wrapping anchor. Otherwise it won't wrap correctly.
<a style="display:block" href="http://justinbieber.com"> <div class="xyz">My div contents</div> </a>