Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

href

add

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>
like image 710
Wardenclyffe Avatar asked Jun 15 '12 19:06

Wardenclyffe


People also ask

Can we add HREF in div?

If you absolutely need to use JavaScript, one way is to find a link inside the div and go to its href when the div is clicked. This is with jQuery: $(". myBox").

Can div be clickable?

The answer is definitely yes, but you will need to write javascript code for it. We can use a click handler on the div element to make it clickable.

Can you add HREF in CSS?

You cannot simply add a link using CSS. CSS is used for styling. You can style your using CSS.


1 Answers

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>
like image 193
Philip Kirkbride Avatar answered Sep 20 '22 13:09

Philip Kirkbride