3 ms·
My rule is "anchor tag for everything unless it's a form submission", in which case, button.
by fareesh 5y ago
My rule is "anchor tag for everything unless it's a form submission", in which case, button.
- brianzelip 5y agoEven better: "anchor tag for everything that takes a user to a url, button for everything else" (forms and other action/event initiators).
- kevincox 5y agoI don't think this rule. Anchor tags should be used to go somewhere. Buttons should be used to do something. There are cases where these overlap (am I popping up a settings menu (doing something) or navigating to the settings (going somewhere)) but in many cases it is distinct. Furthermore anchors have awesome features such as being able to copy the destination or open the link in a new tab. If the target isn't actually a real location using anchors can be confusing.