Both of the above interactive elements will open a new page if you activate them. If you [ctrl|cmd]-click or middle-click, in some browsers at least, that page will open in a separate tab. I could have added a
target
attribute to either to make the new-tab behavior the default.
This isn't a button or a link
All of the above interactive elements, on activation, will cause new content to appear on this page (in browsers that support details/summary). All three approaches are used in real websites for tab or accordion layouts.
There is no fundamental, functional difference between a link and a button on the web, as far as the actions they trigger.
Buttons and links can
both
be used to modify the current page or to fetch a new one. And you don't need something hacky like a
javascript:
URL to do it.
So it's no surprise that most web developers/designers see nothing wrong with styling a link to look like a button, when it is a standalone element (instead of a linked phrase within paragraph text). Buttons are also sometimes styled like links, to make them look interactive-but-less-important.
However, we still need to be aware of the important differences in UX between links and buttons:
- different names for the element when described by screen readers or voice-control systems
- different default styles and layout
- different default cursor styles
- different default keyboard activation methods (spacebar vs enter-only)
- in some browsers (WebKit), differences in whether the element is included in the tab order by default
- for links vs form-buttons, differences in whether the browser will let you easily discover the target URL
These differences may be arbitrary. They may be unrelated to the primary interaction. But they are real. And they're a pain in the arse. Sometimes a button-link will cause a page refresh. Sometimes it won't. Sometimes I can right-click on a button-link and grab the URL. Sometimes I can't. Sometimes I can control-click so that it opens in a new tab. Sometimes I can't.
And there's nothing about the visible UX—with default styles or with real-world styles—that tells me which is which.