iframe Tag
The iframe
tag is a tag used to display another web page within a web page, often for embedding external videos (e.g., YouTube), maps (e.g., Google Maps), or other external websites.
iframe Tag Example
<iframe src="https://example.com" width="500" height="300"></iframe>
In the example above, using this code will display the example.com
web page within an area of 500x300
size on the current page.
Key Attributes of the iframe Tag
The iframe
tag can utilize the following attributes.
src
The src
attribute specifies the URL of the web page to be embedded.
iframe src Attribute Example
<iframe src="https://example.com"></iframe>
width and height
The width
and height
attributes specify the size of the iframe
.
iframe width & height Attribute Example
<iframe src="https://example.com" width="400" height="250"></iframe>
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.