WeCode
Academy
Tutorials
Web Development
Bootstrap
CSS
HTML
JavaScript
jQuery
Node.js
PHP
React
TypeScript
Programming
C
C#
C++
Go
Java
Python
Rust
Data and Databases
NumPy
Pandas
SQL
Tools
Bash
Git
Projects
Project: A Tiny Shell in C
Project: Bank Account System
Project: Library Management System
Project: Portfolio Page
Project: Quiz App in React
Project: Sales Data Analysis
Project: Server Log Analyser
Project: To-Do REST API
Project: URL Shortener
Project: Word Counter in Four Languages
All tutorials ❯
Paths
References
Practice
Try it editor
Quizzes
How To recipes
Tools
Glossary
My Learning
🌙
Dark mode
Home
›
How To
›
HTML
Embed a YouTube-style responsive video frame
Wrap an iframe in an aspect-ratio box so it scales.
Example
html
<style> .video { aspect-ratio: 16 / 9; width: 100%; max-width: 420px; background: #000; display: grid; place-items: center; color: #fff; } </style> <div class="video">A 16:9 video area (an iframe goes here)</div>
Run ❯
Reset
Open in editor »
More HTML recipes
Create a basic web page
Make a contact form
Create a table of data
Add a skip link for accessibility
Make a download link