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>
Try creating a class named
overlay
and apply the following css to it:Make sure it is placed in a positioned element.
Now simply place an
<a>
tag with that class inside the div you want to be linkable:PhilipK's suggestion might work but it won't validate because you can't place a block element (
div
) inside an inline element (a
). And when your website doesn't validate the W3C Ninja's will come for you!An other advice would be to try avoiding inline styling.
try to implement with javascript this:
I'd say:
However, it will still be a link. If you want to change your link into a button, you should rename the #buttonone to #buttonone a { your css here }.
Can't you surround it with an a tag?
Your solutions don't seem to be working for me, I have the following code. How to put link into the last two divs.
In this case, it doesn't matter as there is no content between the two
div
s.Either one will get the browser to scroll down to it.
The
a
element will look like:Or: