The iframe tag in HTML
- 24-07-2022
- Trung Minh
- 0 Comments
The iframe tag specifies a routed content. It's used to embed another document in your page.
In fact, the iframe tag has the same effect as the img tag, except that it will embed a document instead of just embedding an image like the img tag.
So when should iframe tags be used for embedding? The most common case is embedding videos from yoytube into your site. The example in the article Variables and variable declarations in javascript, uses videos from youtube, so if you pay attention to the code, you will see the iframe tag used.
Note:
- We can use CSS properties to style the iframe tag.
Using
Example: In this example, I will embed a freetuts video from youtube into the page using the iframe tag.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> Video: HTML căn bản - HTML là gì? Bổ cục HTML của trang web <div> <iframe width="854" height="480" src="https://www.youtube.com/embed/silgKdqMoRk" frameborder="0" allowfullscreen></iframe> </div> </body> </html>