How To Add An "a href" Link To A "div"?

Wardenclyffe picture Wardenclyffe · Jun 15, 2012 · Viewed 170k times · Source

I need to know how to add an a href link to a div? Do you put the a href tag arounf the entire "buttonOne" div? Or should it be around or inside the "linkedinB" div?

Here's my HTML:

<div id="buttonOne">
  <div id="linkedinB">
    <img src="img/linkedinB.png" width="40" height="40">
  </div>
</div>

Answer

Philip Kirkbride picture Philip Kirkbride · Jun 15, 2012

Can't you surround it with an a tag?

  <a href="#"><div id="buttonOne">
        <div id="linkedinB">
            <img src="img/linkedinB.png" width="40" height="40">
        </div>
  </div></a>