HTML Iframes
Embed external pages and media carefully using iframe attributes.
Category: HTML | Lesson: 19 of 40
iframe example
<iframe
src="https://www.youtube.com/embed/VIDEO_ID"
title="HTML lesson video"
width="560"
height="315"
loading="lazy"
allowfullscreen>
</iframe>
src specifies the URL. title describes the frame to assistive technology. loading=lazy can defer off-screen frames.
Security and privacy
Embed trusted content. Consider sandbox restrictions when suitable and understand required permissions first. Third-party embeds can affect privacy and performance.
Responsive frame CSS
.video-frame {
width: 100%;
aspect-ratio: 16 / 9;
border: 0;
}
Practice
Embed a trusted video with a descriptive title, responsive sizing, and lazy loading.
Want to learn this professionally?
Explore practical IT training at Cyber Code Academy.
View Academy Courses