HTML by Patrik

Automatic height for embedded video

In CSS there is an aspect-ratio property. Set the width (In any way: px/%/...) and then add aspect-ratio property with ... well... aspect ratio.

iframe { 
  width: 100%;
  aspect-ratio: 16 / 9;
}

Additional Resources

Comments