HTML <iframe> Element
The <iframe> element allows you to embed another webpage inside your page. Think of it as a “window” showing another site.
1. Iframe Syntax
Basic iframe syntax:
<iframe src="URL" width="WIDTH" height="HEIGHT"></iframe>
2. Set Height and Width
Control the size of the iframe with width and height:
<iframe src="https://www.example.com" width="500" height="300"></iframe>
3. Remove the Border
Use style="border:none" or frameborder="0" to remove the border:
<iframe src="https://www.example.com" width="400" height="200" style="border:none"></iframe>
4. Iframe Target for a Link
You can make a link open inside an iframe using the name attribute:
<iframe src="about:blank" name="myframe" width="400" height="200"></iframe> <a href="https://www.example.com" target="myframe">Open Example.com</a>
Next Lesson → HTML Responsive Design
Previous Lesson → HTML ID Attribute