<div class="container">
  <div class="rem">
    <h2>With rem</h2>
    <a href="#" class="smaller">rem: 16px</a>
    <a href="#" class="larger">rem: 32px</a>
  </div>

  <div class="em">
    <h2>With em</h2>
    <a href="#" class="smaller">em: 16px</a>
    <a href="#" class="larger">em: 32px</a>
  </div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

body {
  background: #333;
  font-family: Inter, sans-serif;
  color: white;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

// Base style
a {
  display: inline-block;
  font-weight: 500;
  text-decoration: none;
  color: inherit;

  border: 0.3px solid white;
  border-radius: 0.5rem;
}

.rem,
.em {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.rem + .em {
  margin-top: 1rem;
}

.rem a + a,
.em a + a {
  margin-top: 1rem;
}

// To differentiate font-size
.smaller {
  font-size: 1rem;
}

.larger {
  font-size: 2rem;
}

.rem a {
  padding: 0.75rem 1.5rem;
}

.em a {
  padding: 0.75em 1.5em;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.