Use buttons instead of A tag for navigation

Use buttons instead of A tag for navigation
0

#1

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?


#2

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


#3

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.


#4

@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:


#5

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.


#6

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