HomeHTMLHTML Iframes

HTML Iframes

HTML Iframes

An HTML iframe (<iframe> tag) is used to show a web page within a web page. in other words, it displays the nested web pages (means a webpage within another webpage).

HTML Iframe Syntax

<iframe src="url" title="description">
  • src – It defines the web address
  • title – Defines what the content of the iframe is

It is considered good practice if you use the title attribute for the <iframe> tag. it tells users what the content of the iframe is.

How to set height and width attributes in HTML Iframe

Well, we can also add the height and width in HTML Iframe. for this, we use “height” and “width” attributes.

Note: the values of “height” and “width” attributes are in pixels by default. it can be specified in percentage.

Example:

<!DOCTYPE html>
<html>
<body>

<h2>HTML Iframes - PrepareExams </h2>
<p> How to use the height and width attributes in iframe tag: </p>

<iframe src="https://www.prepareexams.com/" height="350" width="400" title="PrepareExams"></iframe>

</body>
</html>

How to Remove Border of Iframe in HTML

We can use the CSS border property and <style> attribute  to To remove the border. the example is here

<!DOCTYPE html>
<html>
<body>

<h2>How to Remove the Iframe Border: PrepareExams</h2>

<iframe src="https://www.prepareexams.com/" style="border:none;" title="Remove Border" width="400" height="400"></iframe>

</body>
</html>

How to Change size, Color & Style of Iframe Border in HTML

Example:

<!DOCTYPE html>
<html>
<body>

<h2>How to Change size, Color & Style of Iframe Border: PrepareExams</h2>

<iframe src="https://www.prepareexams.com/" style="border:5px dotted red" title="Remove Border" width="400" height="400"></iframe>

</body>
</html>

HTML tutorials:

HTML ID Attribute: Definition, How to use, Syntax

HTML class Attribute: Definition, How to use, Syntax

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest News