943,919 Members | Top Members by Rank

Ad:
Oct 19th, 2005
0

height: 100% - cannot get this to work

Expand Post »
I have a wrapper with two columns using float: left to align them and a clear: both on an hr tag underneath them. When I used to work in html 4.0 this method used to work allowing the background images in the div of each column to stretch to the same height. However the clear: both doesn't seem to work in XHTML 1.0 strict (unless I'm just doing something wrong).

If anyone would be kind enough to take a look it would be hugely appreciated. If you know what you're doing you'll probably see my errors quickly.

I'm using these styles:

html { min-height: 100%; }

body {
margin: 0px;
padding: 0px;
background-image: url(images/autumn/body_bg.gif);
text-align: center;
height: 100%;




}
#wrapper {
margin: 0px auto;
padding: 0px;
width: 800px;
background-color: #CCCCFF;
background-image: url(images/autumn/right_col_bg.gif);
background-repeat: repeat-y;
background-position: right;
height: 100%;




}
#content-area {
margin: 0px;
padding: 0px;
width: 552px;
text-align: center;
float: left;
background-image: url(images/autumn/content_bg_slice.gif);
background-repeat: repeat-y;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #333366;
min-height: 100%;

}
#content-area-top {
background-image: url(images/autumn/content_area_top.gif);
margin: 0px;
padding: 0px;
height: 20px;
width: 552px;
}
#right-col {
background-image: url(images/autumn/right_col_bg.gif);
background-repeat: repeat-y;
margin: 0px;
padding: 0px;
width: 248px;
text-align: center;
background-color: #333366;
color: #CCCCFF;
float: left;
height: 100%;



}

As it is the left column - content-area - does not stretch to 100% screen height. As you can see I've got the background image for the right column in the wrapper so that when the left column is longer than the right they both stretch to 100% and that is how I want it. But when the right column content is longer than the left column the left column background image stops where the content stops.

I'm not sure if I'm allowed to post url's but this will probably help:

www.ukmortgageinfo.com

Any suggestions?

Thanks in advance.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chrisjb is offline Offline
16 posts
since Sep 2005
Oct 19th, 2005
0

Re: height: 100% - cannot get this to work

The 100% height is always refer to the screen height, NOT the height of your content. If you are using 1024x768 screen resolution, the 100% height will be 768 pixels, eventhough you have your content more than this height.

I look through your script and found you control the layout using css alone, which is NOT what many programmers will do. I would suggest you use HTML table tags to align the two columns so that they stretch together when one of the column is longer than the other. As you are using dreamwaver and template to control the consistency of your pages, it will not be too difficult to change this for all your pages.

By the way, I really like the simple yet freash deisgn of your site.
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Oct 19th, 2005
0

Re: height: 100% - cannot get this to work

Thanks Zippee,

But I can't go back to tables - too much effort and I'm a CSS man now. You're right about the 100% being for the screen size - that's what happened when I set html as height: 100% instead of min-height: 100%.

It seems to me that one of CSS's strongest flaws is vertical layout - whether it is aligning vertically or defining heights CSS has problems. In this case tables would be easier, but I would rather find the solution than use a fix.

Thanks for your help anyway.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chrisjb is offline Offline
16 posts
since Sep 2005
Nov 6th, 2005
0

Re: height: 100% - cannot get this to work

Sometimes setting overflow makes a difference in how the height is treated.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Nov 15th, 2005
0

Re: height: 100% - cannot get this to work

Hi,

I'm new to CSS (still working on my first layout)! I don't know if the following link will help, but here it is:

http://www.alistapart.com/articles/fauxcolumns/

CJ

Quote originally posted by chrisjb ...
Thanks Zippee,

But I can't go back to tables - too much effort and I'm a CSS man now. You're right about the 100% being for the screen size - that's what happened when I set html as height: 100% instead of min-height: 100%.

It seems to me that one of CSS's strongest flaws is vertical layout - whether it is aligning vertically or defining heights CSS has problems. In this case tables would be easier, but I would rather find the solution than use a fix.

Thanks for your help anyway.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jeweline is offline Offline
2 posts
since Nov 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Help with CSS - background extending to 100%
Next Thread in HTML and CSS Forum Timeline: form to get e-mail and name --- for newsletter





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC