<div class="card">
  <h2>A Card Component</h2>
  <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Reprehenderit porro deleniti laboriosam ab voluptate quis mollitia modi, sit itaque dolorum.</p>
</div>
html {
  --mq-sm: initial;
}
@media (max-width: 900px) {
  html {
    --mq-sm: ;
  }
}

.card {
  --padding-when-small: var(--mq-sm) 2rem;
  --padding-when-large: 4rem;

  padding: var(--padding-when-small, var(--padding-when-large));
}

* {
  box-sizing: border-box;
}
body {
  padding: 2rem;
  margin: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  font: 100%/1.4 system-ui, sans-serif;
}
.card {
  border: 1px solid #ccc;
  border-radius: 0.3rem;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.15);
}
.card h2 {
  margin: 0 0 0.5rem;
}
.card :last-child {
  margin-block-end: 0;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.