Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Elements

0/1

HTML Attributes

0/1

HTML Headings

0/1

HTML Paragraphs

0/1

HTML Styles

0/1

HTML Formatting

0/1

HTML Quotation

0/1

HTML Comments

0/1

HTML Colors

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Block and Inline

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML - The Head Element

0/1

HTML Style Guide

0/1

HTML Entities

0/1

HTML Symbols

0/1
Text lesson

HTML Iframes

HTML Iframe Syntax

The HTML <iframe> tag defines an inline frame.

An inline frame serves the purpose of embedding another document inside the current HTML document.

Syntax

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

Remember to consistently include a title attribute for the <iframe>. This assists screen readers in vocalizing the content contained within the iframe.

Iframe – Set Height and Width

Utilize the height and width attributes to define the dimensions of the iframe.

By default, these dimensions are specified in pixels.

Example

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

Alternatively, you can incorporate the style attribute and apply CSS height and width properties to adjust the dimensions of the iframe.

Example

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

Iframe – Remove the Border

By default, an iframe is surrounded by a border.

To eliminate the border, include the style attribute and utilize the CSS border property.

Example

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

CSS allows you to modify the size, style, and color of the iframe’s border as well.

Example

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

Iframe – Target for a Link

An iframe can serve as the designated target frame for a hyperlink.

The target attribute of the hyperlink must correspond to the name attribute of the iframe.

Example

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

<p><a href=”https://code7school.com/” target=”iframe_a”>code7school.com</a></p>

Summary of the Chapter

  • The HTML <iframe> tag denotes an inline frame.
  • The src attribute dictates the URL of the page to be embedded.
  • Ensure to consistently incorporate a title attribute, especially for accessibility with screen readers.
  • The height and width attributes determine the dimensions of the iframe.
  • To eliminate the border surrounding the iframe, utilize border:none; CSS property.

 

Click to Learn