- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Alternative to iFrames in HTML5
The HTML <iframe> tag specifies an inline frame (container). This inline frame is used to embed another document within the current HTML document. The "srcdoc" attribute of the <iframe> tag is used to specify the HTML content of the page to be displayed in the <iframe>.
HTML <embed> Tag
The alternative tag to iframe in HTML is
Following are the attributes of the HTML
height − It specifies the height of the embedded content.
src − It specifies the address of the external file.
type − It specifies the media type of the embedded content.
width − It specifies the width of the embedded content.
Note − It is recommended to use the <img> tag for displaying a picture, <iframe> tag to display HTML, and <video>, <audio> tags to display video or audio.
Example
In the following example, we are using the <embed> tag as an alternative for <iframe> to embed an image onto the webpage. −
<!DOCTYPE html> <html> <head> <title>Embed tag in HTML</title> <style> embed { border: solid 2px black; } </style> </head> <body style="text-align: center;"> <h2>Alternative for iframe is embed tag.</h2> <embed type="image/jpg" src="beach.jpg" width="300" height="200"> </body> </html>
Example
Here, we are embedding an HTML page using the HTML <embed> tag −
<!DOCTYPE html> <html> <head> <title>Embed tag in HTML</title> <style> embed { border: solid 2px black; } </style> </head> <body style="text-align: center;"> <h2>Alternative for iframe is embed tag.</h2> <embed type="text/html" src="https://www.tutorialspoint.com/index.htm" width="500px" height="350px"> </body> </html>