<div class="aspectratio"> 16:9</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #222;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
gap: 10px;
}
.aspectratio {
width: 50vh;
background-color: #09f;
aspect-ratio: 16 / 9;
display: flex;
justify-content: center;
align-items: center;
animation: change 15s linear alternate infinite;
}
@keyframes change {
0% {
width: 30vh;
}
100% {
width: 60vh;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.