<button class="btn">
  <span class="btn__text">Add to basket</span>
</button>


<button class="btn btn--icon-only">
  <svg class="btn__icon" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>
  <span class="btn__text sr-only">Add to basket</span>
</button>

<button class="btn">
  <svg class="btn__icon" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>
  <span class="btn__text">Add to basket</span> 
</button>
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  font-size: 1.25rem; //20px
  line-height: 1.5;
  height: 2.4em;
  border: 0;
  border-radius: 10000px; //hack to make sure that the border radius grows the right way if font is resized
  padding: 0 1.25em;
  background-color: #188122;
  color: #fff;
  font-family: "Roboto Mono", monospace;
}

/* Add margin to the left of the second child of the button — makes it possible to switch text and icon positions */
.btn > * + * {
  margin-left: 1rem;
}

.btn--icon-only {
  width: 3rem;
  padding: 0;
}

.btn__icon {
  width: 1em;
  height: 1em;
}

.sr-only {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  padding: 0;
}

.btn:focus {
  outline-style: solid;
  outline-color: transparent;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px #188122;
}

.btn::-moz-focus-inner {
  border: 0;
}

@media screen and (-ms-high-contrast: active) {
  .btn {
    border: 2px solid currentColor;
  }
}










/* demo styles - not essential to buttons */
@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@500&display=swap");

body {
  margin: 0;
  text-align: center;
}

* {
  box-sizing: border-box;
}

.btn {
  margin: 2rem;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.