View Full Version : why does an iframe require that the frameborder="0" be used in the xhtml

07-05-2007, 08:48 PM
Oops,I meant iframe.

Surely it is presentational mark up and as such, should really go in the CSS.

or have I missed some unusual css tag for it?


07-06-2007, 06:58 AM
I don't understand what you mean by "requiring" frameborder; do you mean in a CSS sense? Or a validation sense.

07-06-2007, 08:24 AM
border:0; would work in Firefox but unfortunately IE has no support for this on iframes which is why frameborder="0" is still needed. IMO you shouldn't be using iframes in the first place.

07-06-2007, 12:16 PM
Thanks _Aerospace_Eng_.

That's exactly what I found and so I have border:0 in the css and now, frameborder="0" in the html.

whats your alternative suggestion for the iframe?


07-06-2007, 06:51 PM
Creating separate pages and using server side includes would be the alternative. What is your reason for using an iframe?

07-06-2007, 07:07 PM
its my own cms system where the main file contains the session data and is the login script. The files in the iframe are then only accessible if the user has logged in and so, they cannot be looked at as stand-alone files. (subject to someone craking into it that is :( )


07-06-2007, 07:27 PM
Still no need for the iframe. A server side language like PHP can detect when a user navigates to a file directly. You can then do what you wish with the page. This is what I use on my site for my php includes at the very top of them.

// do something