Iframes in HTML:
In HTML Iframe is used to display a webpage inside or within a webpage. With the help of Ifrmae you can open multiple HTML documents in one browser.
Example:
Following example is display a simple Iframe. Here we create two html documents one is “iframe.html” and second one is “ex_frame.html”
1 2 3 4 5 6 7 8 9 10 |
<!doctype> <html> <head> <meta charset="utf-8"> <title>IFrame</title> </head> <body> <iframe src="ex_frame.html"></iframe> </body> </html> |
Iframe without Border:
You can remove the border of frame by applying “frameborder” attribute.
Example:
1 2 3 4 5 6 7 8 9 10 11 |
<!doctype> <html> <head> <meta charset="utf-8"> <title>IFrame</title> </head> <body> <iframe src="ex_frame.html" frameborder="0"> </iframe> </body> </html> |
Height and Width of Iframe:
You can also set the height and width of an Iframe. It will take height and width by default in pixels but you can also set them as percentage.
Example:
1 2 3 4 5 6 7 8 9 10 11 |
<!doctype> <html> <head> <meta charset="utf-8"> <title>IFrame</title> </head> <body> <iframe src="ex_frame.html" frameborder="0" height="300px" width="200px"> </iframe> </body> </html> |
Target Attribute in Iframe for a Link:
The target attribute in Iframe is used to target a link on that particular Iframe. To target any link you have to specify the name of Iframe.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!doctype> <html> <head> <meta charset="utf-8"> <title>IFrame</title> </head> <body> <iframe src="ex_frame.html" name="frame" frameborder="0"> </iframe> <br> <a href="www.techieweb.in" target="frame"> TechieWeb </a> </body> </html> |
Leave a Reply