Frontend Web Dev
Good Practices
Divs should never be clickable elements - Not accessible, don't work with screen readers, don't work with keyboard actions like tab, return or space.
Button- comes with built-in styling, usually a bad thing. (
all: unset) can come in handy. - inside of a form, the
onClickwill fire a submit
- comes with built-in styling, usually a bad thing. (
Buttonsshould not be used for navigation.- Not crawlable for SEO
- "Open link in new tab", middle clicks will cause issues.
- Many current UI libraries render an anchor tag if a
hrefproperty is passed in -> can define your own button component to do the same thing.
CSS
// overrides all default rules
button {
all: unset;
}