The border property sets the border of an element.
The border of the iframe can be specified by applying this property to the IFRAME element.
iframe {
border: 2px red solid;
}
| Property | Value | Explanation |
|---|---|---|
| border | each value | sets width, color, and style |
Screen shots of examples
iframe { border: 2px red solid; }
| MSIE 7 | Firefox 1 | Opera 9 |
|---|---|---|
![]() |
![]() |
![]() |
In MSIE, the default border is displayed around the iframe at the same time. If you doesn't want to display this default border, specify the frameborder attribute for the IFAME element.
<iframe src="example.html" frameborder="0"></iframe>
(MSIE 7)
<html> <head> <title>TAG index</title> <style type="text/css"> iframe { width: 300px; height: 100px; } #example1 { border: none; } #example2 { border: 1px green solid; } #example3 { border: 2px green dashed; } </style> </head> <body> <p><iframe src="example.html" id="example1">Alternate content</iframe></p> <p><iframe src="example.html" frameborder="0" id="example2">Alternate content</iframe></p> <p><iframe src="example.html" frameborder="0" id="example3">Alternate content</iframe></p> </body> </html>