<article class="box">
  <h1>A semantic, breakout button</h1>
  <p>This whole box is clickable, but still uses a button element, correctly. It also only behaves like this <i>if</i> JavaScript is available and working.</p>
  <button class="breakout-button" type="button" hidden>Say Hi 👋</button>
</article>
.box {
  color: #fff;
  padding: 2rem;
  max-width: 30rem;
  background: #252525;
  position: relative;
  box-shadow: none;
  transition: transform 300ms ease-in-out, box-shadow 400ms ease, background 100ms ease;
}

[data-interactive]:hover,
[data-interactive]:focus-within {
  background: #111111;
  box-shadow: 0 1rem 1rem rgba(0,0,0,0.3);
  transform: translateY(-0.5rem);
}

.box > * + * {
  margin-top: 1em;
}


.breakout-button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 2rem;
  background: transparent;
  color: currentcolor;
  border: 1px solid;
  transition: background 100ms ease;
  position: static;
}

.breakout-button,
.breakout-button::before {
  cursor: pointer;
}

.breakout-button::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.breakout-button:focus {
  outline: none;
}

.breakout-button:hover {
  background: #333333;
}

.breakout-button:focus::before {
  outline: 1px solid #ffffff;
  outline-offset: -0.8rem;
}

:not([data-interactive]) > .breakout-button::before {
  display: none;
}

/* Presentational styles */

body {
  background: #efefef;
  padding: 3rem 2rem;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 1.2rem;
  line-height: 1.4;
}

h1 {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 600;
}
const button = document.querySelector('.breakout-button');

if(button) {
  button.parentElement.setAttribute('data-interactive', '');
  button.removeAttribute('hidden');
  button.addEventListener('click', evt => {
    evt.preventDefault();

    alert('Oh hi there 👋');
  });
}

External CSS

  1. https://codepen.io/andybelldesign/pen/Ygmwym.css

External JavaScript

This Pen doesn't use any external JavaScript resources.