Learn Basic HTML Complete Course part 18

1 min read

HTML iframes


HTML Iframe is used to display a nested webpage (a webpage within a webpage). The HTML <iframe> tag defines an inline frame.

Iframe Syntax

An HTML iframe is defined with the <iframe> tag:

<iframe src="URL"></iframe>  

Here, "src" attribute specifies the web address (URL) of the inline frame page.


Set Width and Height of iframe

You can set the width and height of iframe by using "width" and "height" attributes. By default, the attribute?s values are specified in pixels but you can also set them in percent. i.e. 50%, 60% etc.

Remove the border of iframe

By default, an iframe contains a border around it. You can remove the border by using <style> attribute and CSS border property.


You can set a target frame for a link by using iframe. Your specified target attribute of the link must refer to the name attribute of the iframe.


Example

<!DOCTYPE html> 
<html> 
  <body> 
<h2>You need to make Internet connection for output : </h2><br>
    <h4>HTML Iframes example By Pixels</h4><br>
    <iframe src="https://touchtogain.blogspot.com" height="400" width="300"></iframe><br><hr> 

 
<h4>HTML Iframes example By Percentage</h4><br>
<iframe src="https://quizdoor.blogspot.com" height="50%" width="70%"></iframe><br><hr> 
 
<h4>Remove the Iframe Border</h4><br>
<p>This iframe example doesn't have any border</p><br>
<iframe src="https://touchtogain.blogspot.com"
style="border:none;"></iframe><br/><hr>
 
<h4>Iframe - Target for a Link</h4><br>
<iframe height="300px" width="250px"
src="new.html" name="iframe_a"></iframe>
<p><a href="https://topblogpk.blogspot.com"
  target="iframe_a">TopBlog Pk</a></p>
<p>The name of iframe and link target must have
same value else link will not open as frame. </p>

  </body> 
</html>  


outputs are:


You need to make Internet connection for output :


HTML Iframes example By Pixels




HTML Iframes example By Percentage




Remove the Iframe Border


This iframe example doesn't have any border





TopBlog Pk

The name of iframe and link target must have same value else link will not open as frame.


You may like these posts

  • HTML TableHTML table tag is used to display data in tabular form (row * column). There can be many columns in a row.We can create a table to display data in tabular form, using <…
  • HTML CommentsComments are some text or code written in your code to give an explanation about the code, and not visible to the user. Comments which are used for HTML file are known…
  • HTML Id AttributeThe id attribute refers to a unique value for an HTML element. This HTML id value can be used with CSS and JavaScript to perform certain task.HTML id with CSSIn CS…
  • HTML File PathsAn HTML file fileName is used to describe the location of a file in a website folder. File paths are like an address of file for a web browser. We can link any exter…
  • HTML ListsHTML Lists are used to specify lists of information. All lists may contain one or more list elements. There are three different types of HTML lists:Ordered List or N…
  • HTML HeadingA HTML heading or HTML h tag can be defined as a title or a subtitle which you want to display on the webpage. When you place the text within the heading tags <h1>…

Post a Comment