<!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
  <div id="app">
    <div class="container row">
      <div class="card">
        <div class="media padding-top-16-0"></div>
        <h2>With aspect-ratio 🐧</h2>
      <div class="card">
        <div class="media no-hack"></div>
        <h2>Without it 😢</h2>

<!-- Use preprocessors via the lang attribute! e.g. <style lang="scss"> -->
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;

button {
  color: #4fc08d;
.container {
  margin: 0 auto;
  max-width: 800px;
  display: flex;
  justify-content: space-around;
.card {
  overflow: hidden;
  width: 45%;
  background: white;
  border: 1px solid #e5e5e5;
  min-height: 300px;
  border-radius: 10px;
  box-shadow: 0 4px 25px 0px rgb(0 0 0 / 20%);

.media {
  background: url("https://res.cloudinary.com/alvarosaburido/image/upload/v1613494470/as-portfolio/Youtube_-_Thumbail_Create_modals_with_Vue3_Teleport_TailwindCSS_rughpn.png");
  background-size: cover;

h2 {
  padding: 1rem;
  text-align: left;

.padding-top-16-0 {
  aspect-ratio: 16 / 9;

.no-hack {
  min-height: 200px;

img {
  width: 100%;

button {
  background: none;
  border: solid 1px;
  border-radius: 2em;
  font: inherit;
  padding: 0.75em 2em;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.