It's better to use <button>
rather than <div>
or any other element to represent a button. The "type" attribute is important here and should be type="button"
, without it the default value is submit
which doesn't make sense outside of a form.
And yeah by the way, having a <button>
outside of a form is perfectly fine.
Often times while designing a UI, the <a>
tag is the most appropriate element where it makes sense, but <button>
is perfectly fine (and really, intended) for performing an action via javascript.
Using the <div>
tag seems to be the most common way of making buttons (bootstrap) but I am not sure why.
I really haven't seen evidence of this, and to be honest it doesn't matter what they do. The bootstrap framework tends to disregard semantics, for example though the use of empty elements just for presentational reasons like <li class="divider"></li>
.