HTML Embed
By Tony 2024.1.24 • Last updated 2024.1.24
HTML embedding is very useful when you want to embed, or have, other websites' contents or pages to be on your own web page. For example: a YouTube video, a Google Forms, a Wikipedia article, or even other pages in your own website.
<iframe src="https://mac-web.github.io" width="800px" height="500px"></iframe>
In this example, we used the <iframe> tags to embed MacWeb to our web page. There are three attributes: src, width, and height.
- Iframe: Think of it as an actual frame that can display almost any webpage on your page. (Some webpages may not be able to display because of security concerns and cross-platform policies)
- Src: the src attribute tells the browser which webpage the iframe is displaying. Put the URL of the webpage that you want to display here.
- Width & Height: the width and height attributes tell the browser how big the iframe should be.
Here's the output of the example:
In conclusion, if you want to put another webpage on your own webpage, use the <iframe> tags with the URL of the site in the src attribute.