Iframe tag in HTML


The iframe tag in HTML is used to embed a web page in the current web page. Refer to the following article of Taimienphi.vn to find out iframe tags in HTML.


The following article Taimienphi.vn will introduce you to iframe tags in HTML. Also readers can refer to some other articles already on Taimienphi.vn to learn about id attribute in HTML.

Iframe tag in HTML

Table of Contents:
1. The iframe tag in HTML
2. Iframe syntax in HTML
3. Set height and width of iframes in HTML
4. Delete the border on the iframe
5. Use iframes as the destination frame for the link

1. The iframe tag in HTML

We can specify iframe (inline frame) by using iframe tag. The iframe tag is not related to the frameset tag, and may appear anywhere on the document.

Properties src Used to specify the URL of the page containing the iframe.

2. Iframe syntax in HTML

Iframes in HTML are specified with iframes.

the iframe in html

Properties src Specifies the URL (web address) of the page that contains the inline frame.

3. Set height and width of iframes in HTML

We use properties Cao and width to specify the size of the iframe.

– The default iframe height and width are specified in pixels.

Example 1: In the example below we specify the size for the iframe in pixels:

the iframe in html 2

The result returned after applying the height and width attributes in pixels to specify the size of the iframe looks like this:

the iframe in html 3

– Also we can specify the iframe size in percent (%):

Example 2: In the example below we specify the size for the iframe in%:

the iframe in html 4

The result returned after applying the height and width attributes in units of% to specify the size of the iframe looks like this:

the iframe in html 5

– Or use CSS to set the width and height of the iframe.
Example 3: In this example we use CSS to set width and height for iframes:

the iframe in html 6

The result returned after applying CSS to specify the size of the iframe looks like this:

the iframe in html 7

4. Delete the border on the iframe

By default, iframes have borders.
To delete this border, we add the attribute style and use attributes border in CSS.
Example 1: The following example illustrates how to remove borders for iframes in HTML:

the iframe in html 8

The result will look like this:

the iframe in html 9

With CSS, we can change the size, style and color of the iframe borders.
Example 2: In the following example we will change the size, style and color of the iframe border:

the iframe in html 10

The result will look like this:

the iframe in html 11

5. Use iframes as the destination frame for the link

In addition, we can use iframes as the target frame for the link.
Properties target The link (link) must refer to the attribute name of iframe.
For example: In the example below we use the iframe as the target frame for the link:

the iframe in html 12

The result will look like this:

the iframe in html 13

https://thuthuat.taimienphi.vn/the-iframe-rong-html-50638n.aspx
The article above Taimienphi.vn has just introduced to you the iframe tag in HTML. In addition, if you have any questions or questions, you can leave your comments in the comment section below the article. You want to learn HTML and learn more in the next article Taimienphi.vn will introduce you more about how to embed JavaScript into the HTML.

.

Add a Comment

Your email address will not be published. Required fields are marked *