Anonymous 0

So my entire page is as follows

<html>
<body>
<iframe src="http://example.com/" width="100%" height="100%" />
</body>
</html>

As you can see, I've put 100% as both my height and width, yet firefox still creates a border around my <iframe>! is there any way around this? How do I get rid of it? Will other browsers do the same? I basically need my page to emulate http://example.com exactly, so my users won't know the difference.

Thanks!

3 answers

danwellman 5600
0
points
This was chosen as the best answer

the iframe element has an attribute called frameborder which can be set to 0 to disable the border.

Answered over 7 years ago by danwellman
Emily G 620
3
points

Set the border to 0. Here it is inline. You can also put it in the <head> of the document or an external file.

<iframe style="border:0" src="http://example.com/" width="100%" height="100%" />

Since my link in my comment did not work I will repeat it here:

'border:0' is a CSS property that says do not display a border. CSS is used to describe how the HTML elements on your page should be displayed. A good explanation of CSS is here: Beginner's Guide to CSS

Answered over 7 years ago by Emily G
  • What do you mean, put it in an external file? Put what in an external file? THanks though, will try this. Tim over 7 years ago
  • Also, is there any way for me to have the <title> of the page in the iframe show as the <title> for my page? THanks again. Tim over 7 years ago
  • Oh, I see, you mean put it in a separate CSS file. like <link rel="stylesheet" href="stylesheet.css" />, where stylesheet.css is something like #myiframe{border: 0;} and the iframe has an id of "myiframe". That must be what you meant. Tim over 7 years ago
  • 'border:0' is a CSS property that says do not display a border. CSS is used to describe how the HTML elements on your page should be displayed. A good explanation of CSS is here: http://friendlybit.com/css/beginners-guide-to-css-and-standards/ Emily G over 7 years ago
  • isn't it border:none; ? 0 is a possible value for border-width danwellman over 7 years ago
  • border is actually a short-hand notation for the border properties width, style, color. border: 1px solid red; If a property is not specified, it is defaulted. border:0 sets the border-width to zero. border:none sets the border-style to none. They both suppress the display of the border. It's personal preference on which to use. Emily G over 7 years ago
1
point

You should be aware that at least some browsers (Opera is one) allow the user to insist on frames and iframes always having a border (an outline, actually) - this cannot be overriden by the site.

Answered over 7 years ago by Richard Grevers