I have learnt from this post that always use <a>
tags or <button>
tags to make button. Now I'm trying to use <a>
tag. My question is: is there any way to increase the tag clickable area? Say I'm using <a>
in a div box. I want the whole div box to become a button. Can I change the clicking area to the whole div box?
Thanks for you help.
@t1m0thy's answer is more elegant than mine. It's better to follow his advice.
Also, nice link proposed by @aldemarcalazans in the comments: https://davidwalsh.name/html5-buttons.
Original answer:
Use <a />
when you need a link (the a of anchor). Use <button />
when you need a button.
That said, if you really need to expand an <a />
, add the CSS attribute display: block;
on it. You'll then be able to specify a width and/or a height (i.e. as if it were a <div />
).