Making divs in CSS equal page length

Discussion in 'CSS' started by Kat2, Mar 31, 2006.

  1. #1
    Hi all, this was brought about by my post in the website review forum.

    Okay, I'm experimenting and need a bit of help.

    http://upontherainbow.com/test/test.html

    Right now I have that darker blue side bar. How do I make it go the entire length of the page, yet be flexible? For example, if the page itself is 500 pixels, I don't want the darker blue to stop at 400px nor to make the page 600px (if I set the height at 400 or 600 respectively.) If I don't set a height at all, it disappears completely.
     
    Kat2, Mar 31, 2006 IP
  2. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ohh so you want it to be 100% tall and expand/contract with the window? Good luck. I've yet to figure this out and all the logical code doesn't work. Not with Firefox anyways. :(
     
    TwisterMc, Mar 31, 2006 IP
  3. Dalamar

    Dalamar Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You should be able to to do that like "height: 100%;"
     
    Dalamar, Mar 31, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    kk5st, Mar 31, 2006 IP
  5. SoxFan

    SoxFan Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    kk5st is right, you have to use faux colums. You would create an image and apply it as a background to the body selector.
     
    SoxFan, Mar 31, 2006 IP
  6. Kat2

    Kat2 Well-Known Member

    Messages:
    143
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #6
    Kat2, Mar 31, 2006 IP
  7. SoxFan

    SoxFan Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Take the backround image off of the sidebar div and apply it to the body tag.
     
    SoxFan, Mar 31, 2006 IP
  8. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
    
    <html lang="en-us">
    
    <head>
    	<title></title>
    	<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    	<style type="text/css" media="screen">
    
    		BODY {
    			height: 100%;
    			margin: 0;
    		}
    
    		#Menu {
    			position: absolute;
    			top: 0;
    			left: 0;
    			width: 150px;
    			height: 100%;
    			border-right: 2px solid silver;
    			background-color: rgb(245,245,245);
    		}
    
    		#Page {
    			border: 1px dotted red;
    			margin: 8px 8px 8px 160px;
    		}
    
    	</style>
    </head>
    
    <body>
    
    	<div id="Page">
    
    		<div id="SiteTitle">
    			<h1>Hello, World!</h1>
    		</div>
    
    		<div id="Menu">
    			<h2>Menu</h2>
    			<ul>
    				<li><a href="One">One</a></li>
    				<li><a href="Two">Two</a></li>
    				<li><a href="Three">Three</a></li>
    				<li><a href="Four">Four</a></li>
    				<li><a href="Five">Five</a></li>
    			</ul>
    		</div>
    
    		<div id="PageText">
    			<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut magna. Nulla diam est, varius sit amet, blandit et, rhoncus at, nisi. Cras ut dolor. Proin blandit, diam non laoreet molestie, diam nisi tincidunt felis, nec facilisis nulla augue eget ante. Aliquam at tellus ac justo ornare bibendum. Pellentesque consequat, enim quis ultricies ornare, odio dui varius justo, a porttitor urna massa eu mi. Nam fermentum. In scelerisque mattis ante. Ut nunc. Quisque sed quam. Suspendisse vitae enim sit amet lacus bibendum scelerisque. Aenean mattis, nulla eget dignissim congue, magna lacus imperdiet justo, sed pulvinar velit eros ac arcu. Ut arcu ligula, tincidunt in, semper sed, pretium id, urna. Aenean mattis felis lacinia lectus. Cras diam magna, consequat non, rhoncus in, consectetuer eget, leo.</p>
    			<p>Phasellus dapibus. Praesent blandit, diam ut tincidunt vehicula, ipsum nunc pretium est, eu gravida ligula metus sit amet lacus. Vestibulum ullamcorper, metus sit amet elementum tempor, quam velit vestibulum purus, vitae venenatis purus mauris eu ipsum. Maecenas ut nulla non massa gravida tristique. Praesent vitae ante. Duis mollis nulla in nisi. Nulla massa nisl, dignissim a, sagittis eget, adipiscing in, turpis. Ut lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam ut odio. Sed molestie metus ac quam. In eget risus et lectus ultricies sagittis. Aenean ullamcorper nulla ultricies dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus congue volutpat odio. Donec porttitor egestas sapien. Ut felis. Vivamus non tellus eget tortor faucibus sodales. Duis nisl dolor, dapibus ut, fringilla feugiat, rutrum in, sem. Proin ultricies nisl a libero.</p>
    		</div>
    
    	</div>
    
    </body>
    
    </html>
    HTML:
     
    FeelLikeANut, Mar 31, 2006 IP
  9. Kat2

    Kat2 Well-Known Member

    Messages:
    143
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #9
    Okay, it's working now, thanks!
     
    Kat2, Apr 1, 2006 IP