I'd like to style a <button> element so that it looks and behaves like a link. In particular, I'd like the button's content to flow within paragraph text in the same way that an anchor or span element would. The basic css for making a "link-like" style, resetting the browser's defaults and adding link-ish styling, is something like this:
button.link-like { /* reset browser defaults */ border-style: none; background: transparent; padding: 0; display: inline; white-space: normal; /* link look */ color: #0000ee; text-decoration: underline; cursor: pointer; } <!DOCTYPE html> <html> <head><title>Test button links</title></head> <body> <div style="width: 200px; outline: 1px solid red;"> This is a <a href=''>just a normal link that wraps to two lines.</a> </div> <div style="width: 200px; outline: 1px solid red;"> This is a <button class="link-like">button that should behave like a link</button>. </div> </body> </html> However, as you can see from running the snippet above, the button's content does not flow within the paragraph, but instead breaks into its own block. It appears as though despite the display: inline, the button is retaining something of an inline-block behavior within the paragraph.
Can a button be styled such that its contents flows within a paragraph like a link?
aria-hidden="true"to keep things tidy. Not ideal, though.