π€ Have you ever embedded a YouTube video and noticed it looks weird on different screens? π€― <iframe>
elements donβt automatically maintain their aspect ratio, which can break responsiveness.
β
Solution: Use the CSS aspect-ratio property!
<iframe style="aspect-ratio: 16 / 9; width: 100%;" src="https://www.youtube.com/embed/VIDEO_ID"></iframe>
π― This keeps your video proportional and scales smoothly across all screen sizes! π
Follow me to stay updated with my future posts:
Top comments (0)