iframe Tag for html CLICK READ MORE




 

HTML <iframe> Tag



Example

An inline frame is marked up as follows:

<iframe src="https://learnhtmlrk.blogspot.com/" title="learnhtmlrk"></iframe>

More "Try it Yourself" examples below.


Definition and Usage of iframe tag

The <iframe> tag specifies an inline frame.

An inline frame is used to embed another document within the current HTML document.

Tip: Use CSS to style the <iframe> (see example below). 

Tip: It is a good practice to always include a title attribute for the <iframe>. This is used by screen readers to read out what the content of the <iframe> is.




Global Attributes

The <iframe> tag also supports the Global Attributes in HTML.


Event Attributes

The <iframe> tag also supports the Event Attributes in HTML.


More Examples

Example

Add or remove iframe borders (with CSS):

<iframe src="/default.asp" width="100%" height="300" style="border:1px solid black;">
</iframe>

<iframe src="/default.asp" width="100%" height="300" style="border:none;">
</iframe>

Default CSS Settings of iframe

Most of the browsers will display the <iframe> element with the following default values:

iframe:focus {
  outline: none;
}

iframe[seamless] {
  display: block;
}

Post a Comment

1 Comments