iframes madness

Code junkies hangout here

Moderators: ChriThor, LXF moderators

iframes madness

Postby guy » Mon Jun 02, 2014 1:31 pm

Not strictly programming as I am avoiding javascript - I don't want my visitors to have to enable it. But html5/css3 comes close enough.

I am trying to use iframes as a way of re-using (transcluding) visual modules across multiple web pages. So I have one small web page for the main header and navbar, one for a side navbar and a third for the page footer. I then have a template for the rest of the pages, which invokes each of these navigation pages in a separate iframe.

Problem is, if I leave the iframe unstyled then a blank bar half an inch or more deep is added to the bottom of the transcluded page. So I get these blank bars underneath the header and footer in every page. Wastes screen space, looks bad, etc.

I can get rid of it by styling each iframe in the template with a height attribute, but that may not be robust across browsers as it ignores the actual page it contains, and will also need ny css stylesheet updating every time the navigation module changes size.

Other than javascript, does anybody have any ideas how to fix this so the iframe sizes properly according to the page it contains?
"We don't need no frikkin' aliens, we c'n do this ourselves!" — anon.
LXF regular
Posts: 1336
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Postby johnhudson » Mon Jun 02, 2014 9:00 pm

At the risk to trying to teach grandmother to suck eggs, iframes have a seamless attribute which may cope with this though there are some caveats about using visual media in these cases.
LXF regular
Posts: 893
Joined: Wed Aug 03, 2005 1:37 pm

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests