<button class="corners-wrapper">
  <div class="corners top side"></div>
  <div>hover me!</div>
</button>

<button class="corners-wrapper">
  <div class="corners top pink"></div>
  <div>or me!</div>
</button>

<button class="corners-wrapper">
  <div class="corners side blue"></div>
  <div>cool, eh?</div>
</button>
body {
  font-family: sans-ser9f;
  --background: white;
  background: var(--background);
  font-size: 18px;
  padding-top: 100px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

button.corners-wrapper {
  /* Reset all the things */
  border: none;
  box-shadow: none;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  /* Some custom styles */
  display: inline-block;
  padding: 16px;
  margin: 4px 8px;
  /* This bit is the only important one */
  position: relative;
}

.corners {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  --border-size: 2px;
  border: var(--border-size) solid black;
  transition: transform 0.2s;
}

.corners:hover, button.corners-wrapper:focus .corners {
  transform: scale(1.1);
}

/* 
 * These are the top/bottom corners.
 * Comment this out if you don't want them.
*/
.corners.top:before {
  content: '';
  position: absolute;
  /* Change this to control the size of the corners. */
  left: 15%;
  width: 70%;
  /* Thick enough to cover the box border. */
  top: calc(-2 * var(--border-size));
  bottom: calc(-2 * var(--border-size));
  border-top: calc(4 * var(--border-size)) solid var(--background);
  border-bottom: calc(4 * var(--border-size)) solid var(--background);
}

/* 
 * These are the left/right corners.
 * Comment this out if you don't want them.
*/
.corners.side:after {
  content: '';
  position: absolute;
  /* Change this to control the size of the corners. */
  top: 15%;
  height: 70%;
  /* Thick enough to cover the box border */
  left: calc(-2 * var(--border-size));
  right: calc(-2 * var(--border-size));
  border-left: calc(4 * var(--border-size)) solid var(--background);
  border-right: calc(4 * var(--border-size)) solid var(--background);
}

.pink {
  border-color: hotpink;
}

.blue {
  border-color: blue;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.