/    Sign up×
Community /Pin to ProfileBookmark

Revisiting CSS full page height

This has been discussed, here, before, and I have read the threads and implemented the various approaches to fix this issue, but to no avail.

In short, I have two problems which seem to be related to the height of the DIV tags I’m using.

#1. In all browsers, my height:100% isn’t working. It’s only rendering the height of the visible window … not the height of the full page. I’ve found several solutions that don’t seem to work for me including putting a blank DIV around all my content (the theory being that the surrounding DIV is the height of the full page and all ‘height:100%’ that are embedded inside it will inherit that value), and making sure that the html element, itself, is equal to a height of 100%. Neither of these worked and I’ve got a colored column of variable width that’s just cutting off just below the fold. Suggestions?

#2. On IE only, my main content area is cutting off the bottom of my content. I’ve checked Position Is Everything, but I can’t seem to figure out what’s causing this. Again, suggestions?

The code I’m using is like this:

[CODE]<head>

<style>
* {
font:normal 10px Arial, Verdana, Sans-serif;
}
html, body, #sw_wrapper, #sw_leftNav, #sw_mainContent {
height:100%;
background:#ffffff;
padding:0px;
margin:0px;
}

#sw_leftNav {
margin:0px;
padding:0px;
background:#cd8b22 url(hands.jpg) no-repeat bottom right;
width:33%;
float:left;
}

#sw_generalNav {
margin:0px;
padding:0px;
width:auto;
}
#sw_mainContent {
margin:0px;
padding:0px;
background:url(background_ripples.jpg) no-repeat left top;
width:67%;
float:right;
}
#sw_pageContent {
position:relative;
top:110px;
padding:10px;
}

#masterLogo {
position:absolute;
left:22.5%;
top:20px;
border:none;
}
#sw_externalSearch {
position:relative;
float:right;
text-align:right;
padding:3px;
}
#sw_searchBut {
position:relative;
top:5px;
}
</style>

</head>
<body>

<img src=”logo2.gif” width=”200″ height=”88″ alt=”Logo” id=”masterLogo” />

<div id=”sw_wrapper”>
<div id=”sw_leftNav”>
<div id=”sw_generalNav”>
XXNavigationXX
</div>
<div id=”sw_catNav”>
<a href=”XXUrlXX” title=”XX”>XXCategoryNameXX</a><br />
</div>
</div>
<div id=”sw_mainContent”>
<form id=”sw_externalSearch”>
<input type=”text” size=”25″ maxsize=”125″ id=”sw_searchField” />
<input type=”image” src=”sw_search.gif” id=”sw_searchBut” />
</form>
<div id=”sw_pageContent”>

</div>
</div>
</div>
</body>[/CODE]

This has been kicking my ass for two days, now, and I’m exhausted. I’m probably not even seeing what I’ve done wrong.

Any help would be very gratefully accepted…

Yours,
Dave

to post a comment
CSS

15 Comments(s)

Copy linkTweet thisAlerts:
@KDLAApr 27.2006 — You might try a min-height setting for your wrapper div.

min-height: 600px;

Instead of floating your main content, keep it "normal," allowing only the left column to float left.

KDLA
Copy linkTweet thisAlerts:
@Sylvan012authorApr 27.2006 — You might try a min-height setting for your wrapper div.

min-height: 600px;

Instead of floating your main content, keep it "normal," allowing only the left column to float left.

KDLA[/QUOTE]

Good suggestions, but -for some reason- they aren't working in IE.

I even tried applying a ludicrous height, 9900px, to every wrapper and, still, got nothing. Now this is interesting because -to me- this means that there must be some active code restricting the height of these elements (over and beyond the declaration of minimum height) to simply one page height.

Oddly enough, I did get the expected hyper-exaggerated results in FireFox.

Gah, this is frustrating!

Anyone else have any further suggestions?

<goes back to plugging code>
Copy linkTweet thisAlerts:
@WebJoelApr 27.2006 — Can you give me an absolute path to your images/files, so I can re-create this document offline and take a kick at it?
Copy linkTweet thisAlerts:
@Sylvan012authorApr 27.2006 — I'm afraid not; it's on a secure server in my employer's development environment.

However, I could email you the image files.
Copy linkTweet thisAlerts:
@WebJoelApr 27.2006 — No, better not. I'd rather not have my IP traced as an 'intruder' whom shouldn't be in a non-public server. :-) I guess I'd wouldn't be in the secure server, but what images are they, -just background-type stuff?


How committed are you to this particular design and build? There are other ways to acheive this, by re-doing what you have in other formats.
Copy linkTweet thisAlerts:
@Sylvan012authorApr 27.2006 — No, better not. I'd rather not have my IP traced as an 'intruder' whom shouldn't be in a non-public server. :-)

How committed are you to this particular design and build? There are other ways to acheive this, by re-doing what you have in other formats.[/QUOTE]

Actually, I'm pretty flexible.

If you can suggest another approach, I'd love to give it a shot.

At the same time -as I'm sure you'll understand- I'd love to know why this code is behaving in this way! ? Holy crap, this is annoying!
Copy linkTweet thisAlerts:
@KDLAApr 27.2006 — Min-height doesn't work in IE, but height does. You can set a height, overflow it, and IE will still display all the content. (It's stupid that way.) For Firefox, you can include an overflow setting, to ensure that all content exceeding the min-height will be displayed.
<i>
</i>min-height: 600px;
height:600px;
overflow: visible;


KDLA
Copy linkTweet thisAlerts:
@WebJoelApr 27.2006 — [CODE]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">

<style>
body, html {border:0; margin:0; padding:0;}
body {font:normal 10px Arial, Verdana, Sans-serif;}



#leftnav {
margin:0px;
padding:0px;
background:#cd8b22 url(hands.jpg) no-repeat bottom right;
width:275px;
height:101%;
float:left; clear:left;}

#content {
position:absolute; top:120px;
line-height:15px;
margin:10px
padding:110px;
background:url(background_ripples.jpg) no-repeat left top;
width:60%;
}


#leftnav ul {position:relative;
top:60px; left:15px; width:150px; border:1px dotted black; padding:15px;}

#leftnav ul li {margin:10px; list-style-type:none;}

#searchbox {float:right; margin:10px;}
#sw_externalSearch {
position:relative;
text-align:right;
padding:3px;
}
h1, {line-height:1em;}

</style>
</head>

<body>

<div id="leftnav">
<ul>
<li>Nav link #1</li>
<li>Nav link #1</li>
<li>Nav link #1</li>
<li>Nav link #1</li>
<li>Nav link #1</li>
</ul>
</div>

<img src="logo2.gif" alt="Logo" style="position:absolute; left:255px; top:65px; width:200px height:88px;" />

<div id="content">

<h1>This is the test page</h1>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>

<div id="searchbox">
<form id="sw_externalSearch">
<input type="text" size="25" maxsize="125" id="sw_searchField" />
<input type="image" src="sw_search.gif" id="sw_searchBut" />
</form>
</div>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>
<p>Paragraph here. Enter your text here. This is for your text and other content. Enter your text here. This is for your text and other content. The content goes in here.</p>

</div><!-- end content area -->
</body>
</html>[/CODE]


Still not getting it right either! :-( Now the right-hand side content when browser window is made smaller, disappears a bit behind the far right... hmm..
Copy linkTweet thisAlerts:
@WebJoelApr 27.2006 — starting to see what you mean... I'm having trouble getting that content to stay 'to the right'...
Copy linkTweet thisAlerts:
@WebJoelApr 27.2006 — well that's a real kicker isn't it... hmm...

(edit) :

I got the right hand column stuff to stay put. Didn't solve the mystery. Left-hand color doesn't stay 100% on screen minimize.

Replaced code above with current (as of this entry) .

I may need to have some of your images 'offline' after all, to understand what you're trying to do...

Alternative is to create a background image for body, then this problem totally goes away.
Copy linkTweet thisAlerts:
@Sylvan012authorApr 27.2006 — Min-height doesn't work in IE, but height does. You can set a height, overflow it, and IE will still display all the content. (It's stupid that way.) For Firefox, you can include an overflow setting, to ensure that all content exceeding the min-height will be displayed.
<i>
</i>min-height: 600px;
height:600px;
overflow: visible;


KDLA[/QUOTE]

Ok, that's useful! I'll test it in a bit ... I just got out of a meeting and have to go running into another...

Thank you!
Copy linkTweet thisAlerts:
@Sylvan012authorMay 01.2006 — Min-height doesn't work in IE, but height does. You can set a height, overflow it, and IE will still display all the content. (It's stupid that way.) For Firefox, you can include an overflow setting, to ensure that all content exceeding the min-height will be displayed.
<i>
</i>min-height: 600px;
height:600px;
overflow: visible;


KDLA[/QUOTE]


Well, it's been a long weekend and I still didn't get this thing bashed-out.

Now, I did try what you suggested and appended min-height, height, and overflow to the leftnav column as a test. I'm afraid it still didn't work. If I gave it a rock-solid value, it was Ok, but when I went over to trying to use a variable height, it lost its mind and drew its value from the height of the window ... not the height of the page.

Any idea why it's behaving this way?

Yours,

Dave
Copy linkTweet thisAlerts:
@KDLAMay 01.2006 — Height based on a percentage isn't cross-browser compliant, unless some sort of container div is used with a pixel value.

You might take a look at http://www.webmasterworld.com/forum83/200.htm

You could change the height to ems, so that when the text size is increased, the div height will also.

But if you do stick with px, I suggest you make the min-height 700px. That would be about right for 1024x768 monitors, and wouldn't put that much out of the screen for those using 800x600 res.
Copy linkTweet thisAlerts:
@Sylvan012authorMay 01.2006 — Height based on a percentage isn't cross-browser compliant, unless some sort of container div is used with a pixel value.

You might take a look at http://www.webmasterworld.com/forum83/200.htm

You could change the height to ems, so that when the text size is increased, the div height will also.

But if you do stick with px, I suggest you make the min-height 700px. That would be about right for 1024x768 monitors, and wouldn't put that much out of the screen for those using 800x600 res.[/QUOTE]


I'll take a look at the link, now.

In the meantime, the big problem is, the site has to be completely pliable as if I were using tables. Each column has to stretch to the bottom of the screen, carrying with it, it's background properties.

I'm looking at PIE's article on the three-column stretch, at the moment, but still not understanding why it works ... I don't see a "height" statement anywhere in its CSS!

That article is located at [URL=http://www.positioniseverything.net/thr.col.stretch.html]http://www.positioniseverything.net/thr.col.stretch.html[/URL]
Copy linkTweet thisAlerts:
@Sylvan012authorMay 01.2006 — Ok, I was able to do it using Position Is Everything's approach of putting a set-width on the left column with a y-repeating image in the body tag to simulate a full-length column. It's not pretty, and I wish there was a way to do it with just DIV-tags, but that finally got it...
×

Success!

Help @Sylvan012 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...