Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hspace/vspace doesn't work in iframe tag in firefox

Status
Not open for further replies.

Bashdon

Technical User
Feb 3, 2009
7
GB
Hi,

I have some text that wraps around the following iframe tag. To create space around the frame I have inserted a space using vspace and hspace. The spaces appear in IE but not in Firefox for some reason. Does anyone know why this is happening?

<iframe width="425" height="350" hspace="10" vspace="10" align="right" frameborder="1" scrolling="no" marginheight="0" marginwidth="0" src="
Any help much appreciated!

Paul
 
Hi

Paul said:
The spaces appear in IE but not in Firefox for some reason.
Probably because it is not mentioned in the section Inline frames: the [tt]IFRAME[/tt] element ?
HTML 4.01 said:
White space around images and objects

Attribute definitions

hspace = pixels [CN]
Deprecated. This attribute specifies the amount of white space to be inserted to the left and right of an [tt]IMG[/tt], [tt]APPLET[/tt], or [tt]OBJECT[/tt]. The default value is not specified, but is generally a small, non-zero length.
vspace = pixels [CN]
Deprecated. This attribute specifies the amount of white space to be inserted above and below an [tt]IMG[/tt], [tt]APPLET[/tt], or [tt]OBJECT[/tt]. The default value is not specified, but is generally a small, non-zero length.
So no [tt]hspace[/tt] and/or [tt]vspace[/tt] for [tt]iframe[/tt].

Feherke.
 
If you want a 10 pixel margin around the iframe, you can do it with CSS:
Code:
<iframe width="425" height="350" [red]style="margin:10px"[/red] align="right" frameborder="1" scrolling="no" marginheight="0" marginwidth="0" src=" ... long URL in here ... "></iframe>
In fact, you can do a lot more of the styling in CSS:
Code:
<iframe style="margin:10px; [red]width:425px; height:350px;  float: right; padding:0;[/red]" frameborder="1" scrolling="no" src=" ... long URL in here ... "></iframe>
(I'm not 100% familiar with the effect of the frameborder and scrolling attributes of an iframe, they may well be CSS-able as well).

Ultimately, you could put all that CSS into a separate style sheet, leaving your iframe (maybe) like this:
Code:
<iframe id="map" src=" ... URL here ... "></iframe>

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
That's cracked it! Many thanks for your help, much appreciated.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top