Use buttons instead of A tag for navigation

Use buttons instead of A tag for navigation


Is it possible to use buttons instead of A tags in only HTML/ CSS to link to a part of the page like when using a A tag for navigation?


I don"t know why you’d want to do that…but YES with bootstrap


No, the href attribute is not a valid attribute for the button element.
I’m not sure why you would need to use a button, you can style the a element to look however you want.


@sammyfak @lasjorg

I just didn’t know if there was a way to do it with buttons. Thanks for the help, ill stick to A elements and styling them :slight_smile:


Yes it has nothing to do with the <button> tag. Even with a div element, you can add cursor: pointer to make it look clickable when hovering.
It’s all about CSS.


You can’t use the div element either, to use a fragment identifier it has to be an element that supports the href attribute.