

I tested with Chrome and Firefox and it is able to pull the second html file into the iframe. I also tested it using XAMP and have the same results.
HTML IFRAME EXAMPLE CODE
I inserted the iframe code on the index.html pulling up the other html file. I created two html files in the same folder. This way, when user will click on above link, its reference page will be opened in target Iframe. I have tried it on my end and yes it works.

Assign a name to the Iframe using name attribute.Ī HTML iframe can be used as the target frame for a html link. In order to style the contents of each frame, the styles must be added to the source document itself. Just as with any webpage, the contents of each frame can be styled with CSS. We can read about that in CSS border tutorial. In other words, frame1.html must be styled by CSS rules contained within frame1.html or within a stylesheet linked to frame1.html. You can set and remove border using CSS attribute as well. iframe always has a border by default, but we can remove it by setting frameborder="0" You can set border width using frameborder attribute. By default, the value of these attribute are specified in pixels, but you can specify in percentage as well.Ĭomplete HTML Iframe program with Height and Width: This is used by screen readers to read out what the content. Here were embedding a document, prepared specifically for this example, by specifying its URI in the src attribute.
Tip: It is a good practice to always include a title attribute for the