<div class="row">
  <div style="--ratio: 4 / 3;" class="item">4:3</div>
  <div style="--ratio: 2 / 3;" class="item">2:3</div>
</div>
.row {
  display: flex;
  gap: 1rem;
}

.item {
  flex-basis: 0;
  aspect-ratio: var(--ratio);
}

.item:first-child {
  flex-grow: 4;
}

.item:last-child {
  flex-grow: 2;
}

/* Additional Styling */

body {
  background: #003;
  color: #fff;
  padding: 2rem;
}

.row {
  max-width: 50rem;
  border: 1px dashed rgb(255 255 255 / 0.4);
  margin-inline: auto;
  padding: 0.5rem;
}

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

.item {
  background: #f09;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  position: relative;
}

.item + .item { background: #09f;}

.item + .item + .item { background: #90f;}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.