Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-05-2006, 12:16 AM   PM User | #1
dlg0351
Regular Coder

 
Join Date: Jan 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
dlg0351 is an unknown quantity at this point
Question CSS Background fill

I am trying to make the conversion from tables where things were so much easier, to using only divs and css.

I am having trouble getting the left div (navigation) to expand vertically as the right div (content) expands. Basically I want the yellow background to be the same height as the blue background, But I don't know the length of the content background because that is going to change on every page.

Using tables the cell expanded automatically as the content grew.

Can anyone help me with this? It seems like an easy and common thing to do, but I am at a loss.

Any help is greatly appreciated!

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title></title>

<
style>
<!--
body {
    
margin5px;
    
padding0px;
    
font-familyarialsans serif;
    
font-size12px;
}

#page-wrapper {
    
width100%;
    
heightauto;
    
border0px solid black;
}

#nav {
    
margin0px 0px 0px 0px;
    
padding5px;
    
floatleft;
    
width150px;
    
backgroundyellow;
}

#content {
    
margin0px 0px 0px 5px;
    
padding5px;
    
floatleft;
    
width240px;
    
backgroundblue;
}
-->
</
style>
</
head>

<
body>

<
div id="page-wrapper">
    <
div id="nav">NAVIGATION</div>
    
    <
div id="content">
    
CONTENT<br />
    
CONTENT<br />
    
CONTENT<br />
    
CONTENT<br />
      
CONTENT</div>
</
div>

</
div>

</
body>
</
html
dlg0351 is offline   Reply With Quote
Old 05-05-2006, 12:18 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Its common but takes more work. Read this article http://www.alistapart.com/articles/fauxcolumns
CSS lacks the ease of making equal columns but faking it works wonders. You could always use JS but kind of defeats the purpose.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-05-2006, 12:37 AM   PM User | #3
dlg0351
Regular Coder

 
Join Date: Jan 2005
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
dlg0351 is an unknown quantity at this point
You're kidding? This is the only way to do this? Using a background image to give the appearance of 2 columns the same height?

Is this really the only way?
dlg0351 is offline   Reply With Quote
Old 05-05-2006, 01:21 AM   PM User | #4
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,895
Thanks: 5
Thanked 187 Times in 184 Posts
Arbitrator is on a distinguished road
You can do it the way shown below. However, you must use an image to get the desired effect, and the content (i.e., navigation, sidebar) must be of a defined width. It's one of the current problems with page divisions for layout; you can't achieve the dynamically expanding columns paradigm without "cheating", so to speak. Table layouts, background-image illusions, and JavaScript are the easiest ways to do this.


<div id="backgroundLeft" style="background: #000 top left repeat-y;">
<div id="backgroundRight" style="background: #000 top right repeat-y;">
<div id="container"></div></div></div>

There's also JavaScript to dynamically make the columns of equal height, however those without Java enabled will not see the effect.
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *

Last edited by Arbitrator; 05-05-2006 at 01:24 AM..
Arbitrator is offline   Reply With Quote
Old 05-05-2006, 04:01 AM   PM User | #5
drhowarddrfine
Senior Coder

 
Join Date: Oct 2005
Posts: 1,340
Thanks: 0
Thanked 61 Times in 60 Posts
drhowarddrfine can only hope to improve
If your wrapper is only to contain the two floated divs, you can just make the wrapper div overflow:auto; and give it the same background color as the nav div. This will look the same as what you want without the faux columns.
drhowarddrfine is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:15 PM.


Advertisement
Log in to turn off these ads.