Learn HTML #33

HTML Iframes

An HTML iframe is used to display a web page within a web page.


HTML Iframe Syntax

The HTML <iframe> tag specifies an inline frame.

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

Syntax

<iframe src="url" title="description"></iframe>

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.


Iframe – Set Height and Width

Use the height and width attributes to specify the size of the iframe.

The height and width are specified in pixels by default:

Example

<iframe src="demo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe>

Or you can add the style attribute and use the CSS height and width properties:

Example

<iframe src="demo_iframe.htm" style="height:200px;width:300px;" title="Iframe Example"></iframe>

Iframe – Remove the Border

By default, an iframe has a border around it.

To remove the border, add the style attribute and use the CSS border property:

Example

<iframe src="demo_iframe.htm" style="border:none;" title="Iframe Example"></iframe>

With CSS, you can also change the size, style and color of the iframe’s border:

Example

<iframe src="demo_iframe.htm" style="border:2px solid red;" title="Iframe Example"></iframe>

Iframe – Target for a Link

An iframe can be used as the target frame for a link.

The target attribute of the link must refer to the name attribute of the iframe:

Example

<iframe src="demo_iframe.htm" name="iframe_a" title="Iframe Example"></iframe>

<p><a href="https://www.apostube.com" target="iframe_a">apostube.com</a></p>

Chapter Summary

  • The HTML <iframe> tag specifies an inline frame
  • The src attribute defines the URL of the page to embed
  • Always include a title attribute (for screen readers)
  • The height and width attributes specifies the size of the iframe
  • Use border:none; to remove the border around the iframe

Categories

219 Responses

  1. Some are medicines that help people when doctors prescribe. Cautions.
    ivermectin 500mg
    safe and effective drugs are available. Prescription Drug Information, Interactions & Side.

  2. Some are medicines that help people when doctors prescribe. Everything information about medication.
    https://stromectolst.com/# stromectol over the counter
    Learn about the side effects, dosages, and interactions. Drugs information sheet.

  3. drug information and news for professionals and consumers. Learn about the side effects, dosages, and interactions. https://avodart.science/# how can i get avodart without insurance
    Commonly Used Drugs Charts. earch our drug database.

  4. drug information and news for professionals and consumers. Learn about the side effects, dosages, and interactions. how much is amoxicillin
    п»їMedicament prescribing information. Definitive journal of drugs and therapeutics.

  5. Comprehensive side effect and adverse reaction information. Read information now.
    non prescription ed pills
    Everything what you want to know about pills. Some are medicines that help people when doctors prescribe.

  6. Best and news about drug. earch our drug database.
    sildenafil 120
    safe and effective drugs are available. Everything what you want to know about pills.

Leave a Reply

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