em-based, css-only, back button with icon

by jorgeluis

HTML

<p>
em-based back button with css left-chevron icon. Not 100% sure if this beats an svg icon, but it does result in super clean markup.
</p>

<button class="has-icon has-chevron-left">Back</button>


<div style="font-size: 30px">
  <button class="has-icon has-chevron-left">Back</button>
</div>


<div style="font-size: 100px">
  <button class="has-icon has-chevron-left">Back</button>
</div>

CSS

:root {
  --primary: #008094;
}
button {
  font-size: inherit;
  border-radius: 0.33em;
}

.has-icon {
  position: relative;
  padding-right: 0.75em;
  padding-left: 1.75em;
}
button.has-icon {
  line-height: 2em;
  border: 0;
  padding-top: 0;
  padding-bottom: 0;
  background-color: var(--primary);
  color: white;
  transition: background-color 500ms, color 500ms;
}


.has-icon:hover,
.has-icon:focus {
  cursor: pointer;
  background-color: #699;
}
.has-chevron-left::before,
.has-chevron-left::after {
  position: absolute;
  content: ' ';
  height: 1em;
  width: 0.15em;
  left: 0.5em;
  background-color: white;
  border-radius: .15em;
}
.has-chevron-left::before {
  bottom: calc(50% - 0.05em);
  transform-origin: bottom;
  transform: rotate(42deg);
}
.has-chevron-left::after {
  top: calc(50% - 0.05em);
  transform-origin: top;
  transform: rotate(-42deg);
}