CSS - Center Div Not Expanding With Content
Hi All,
I have the following layout. The problem I am having is when the "center" div has lots of text in it the text expands out of the "center" div. I would like the div to stretch with the content. Code: <div id="main"> <div id="mainTop"></div> <div id="mainContent"> <div id="left"></div> <div id="center"> Lots and lots of text goes here </div> <div id="right"></div> </div><!-- end of maincontent --> <div id="mainBottom"> <div id="left2"></div> <div id="center2"></div> <div id="right2"></div> </div> </div> CSS Code: html, body{ margin: 0px; padding: 0px; text-align: center; min-height: 100%;} div{ border: 1px solid black;} /* Hack for IE, Reset to 100% height */ html, body, #main, #mainContent, #left, #center, #right, #left2, #right2{ height: 100%; } #left, #center, #right{ height: 100%; } /* End IE Hack */ #main{ position: relative; width: 100%; min-height: 100%; } #mainTop{ margin: auto; position: relative; height: 210px; width: 850px; text-align: left; background-color: yellow; } #mainContent{ margin: auto; position: relative; min-height: 100%; width: 850px; text-align: left; } #left{ position: absolute; min-height: 100%; width: 79px; left: 0px; background-color: yellow; } #center{ border: 1px solid red; position: absolute; width: 696px; left: 79px; background-color: #dcdbdc; min-height: 100%; } #right{ position: absolute; left: 775px; width: 75px; background-color: yellow; } #mainBottom{ margin: auto; position: relative; min-height: 146px; width: 850px; text-align: left; } #left2{ position: absolute; min-height: 100%; width: 79px; left: 0px; background-color: yellow; } #center2{ border: 1px solid red; position: absolute; width: 696px; left: 79px; background-color: yellow; min-height: 100%; } #right2{ background-color: yellow; position: absolute; left: 775px; width: 75px; min-height: 100%; } Also shown he http://www.steudel.org/css/test.php The yellow divs represent images that border the content. The whole layout is supposed to be able to stretch vertically. I'm not sure why the text is not stretching the center div. TIA, Mark Similar TutorialsHello, I started off trying to find a content box that expands depending on screen res because the last one I made would break in the middle if the users screen res was over 1600px wide. This box worked great with the screen res but now I'm trying to put content in it and my content is not expanding the box down. Instead of pushing the box lower and forcing a scroll bar. The content keeps going down past the bottom of the box and makes a scroll bar. Any idea how I can make the box expand with my content? here is a link to my test page. http://www.gamerunion.com/test.html My css code. Code: div#case { position:absolute; z-index:1; top:200px; left:50px; bottom:50px; right:50px; background:url(/assets/images/tile.png) repeat; } div#tlcorner span, div#trcorner span, div#blcorner span, div#brcorner span, div#lftile span, div#rttile span, div#tptile span, div#btmtile span { width:0; height:0; overflow:hidden; display:block; } div#tlcorner { position:absolute; z-index:10; top:0; left:0; background:url(/assets/images/corners.png) -369px 0 no-repeat; width:123px; height:123px; } div#trcorner { position:absolute; z-index:10; top:0; right:0; background:url(/assets/images/corners.png) -246px 0 no-repeat; width:123px; height:123px; } div#blcorner { position:absolute; z-index:10; bottom:0; left:0; background:url(/assets/images/corners.png) 0 0 no-repeat; width:123px; height:123px; } div#brcorner { position:absolute; z-index:10; bottom:0; right:0; background:url(/assets/images/corners.png) -123px 0 no-repeat; width:123px; height:123px; } div#lftile { position:absolute; z-index:5; top:0; left:0; bottom:0; background:url(/assets/images/lr.png) -20px 0 repeat-y; width:20px; } div#rttile { position:absolute; z-index:5; top:0; right:0; bottom:0; background:url(/assets/images/lr.png) 0 0 repeat-y; width:20px; } div#tptile { position:absolute; z-index:5; top:0; right:0; left:0; background:url(/assets/images/tb.png) 0 0 repeat-x; height:123px; } div#btmtile { position:absolute; z-index:5; bottom:0; right:0; left:0; background:url(/assets/images/tb.png) 0 -123px repeat-x; height:123px; } div#case div.content { position:absolute; z-index:10; width:100%; min-height:400px; overflow:hidden; } div#case div.content h1 { font-family: "Times New Roman", serif, sans-serif, Arial; font-size:16px; color:#000000; margin:5px 0; padding:100px 0 0 100px; text-align:left; text-transform:capitalize; } div#case div.content p { font-family: "Times New Roman", serif, sans-serif, Arial; font-size:14px; color:#000000; text-align:justify; padding:0 100px; } HTML Code: <body> <div id="header"> <h1 class="small">GamerUnion</h1> <h2 class="small">For Gaming Addicts by Gaming Addicts.</h2> </div> <div id="case"> <div id="tlcorner"><span>top left corner</span></div> <div id="trcorner"><span>top right corner</span></div> <div id="blcorner"><span>bottom left corner</span></div> <div id="brcorner"><span>bottom right corner</span></div> <div id="tptile"><span>top side tile</span></div> <div id="lftile"><span>left side tile</span></div> <div id="rttile"><span>right side tile</span></div> <div id="btmtile"><span>bottom side tile</span></div> <div class="content"> <div id="nav"> <ul> <li><a href="/" class="current">Home</a></li> <li><a href="/about.html">About</a></li> <li><a href="/forum/">Forum</a></li> <li><a href="/resources.html">Resources</a></li> <li><a href="/contact.html">Contact</a></li> </ul> </div> <h1>Gamerunion</h1> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> <p>Text text text text</p> </div> </div> </body> You can see the problem he BrianRoyer.com The google adsense ad is expanding past the container. Here is my style.css for troubleshooting: Code: html, body { background: #a0a0a0 url(images/main_bg.gif) center top repeat-x; height: 100%; margin-top: 0px; margin-bottom: 0px; height: 100%; } a:link { color: #FFFFFF; text-decoration: underline; } a:visited { color: #FFFFFF; text-decoration: underline; } a:hover { color: #FFFFFF; text-decoration: none; } a:active { color: #FFFFFF; text-decoration: none; } #container { width: 703px; margin: 0 auto; background: #068add url('images/content_bg.gif'); border-left: 5px solid #cdcdcd; border-right: 5px solid #cdcdcd; border-bottom: 5px solid #cdcdcd; } #content em.u { text-decoration: underline; font-style: normal; } #top { padding: 0; border: 0; } #top img { border: 0; } #top h1 { padding: 0; margin: 0; } #leftnav { float: left; width: 160px; margin: 0; padding: .25em 0 0 .75em; } #rightnav { float: right; width: 125px; margin: 0; text-align: center; padding: 1em 1em 0 0; } #rightnav img { margin: 0; border: 0; text-align: center; padding: 1em 0 0 0; } #content { margin-left: 200px; margin-right: 200px; padding: 1em 0 0 0; width: 290px; } #content img.left { margin: 5px; border: 1px solid #000000; float: left; } #content img.right { margin: 5px; border: 1px solid #000000; float: right; } #leftnav img { margin: 0; border: 0; } #google-search img { border: 0; padding: 1em; } #footer { width: 699px; padding-top: 1em; margin: 0 auto; background: #068add url(images/footer_bg.gif) center bottom repeat-x; } #leftnav p, #content p { margin: 0 0 1em 0; text-align: justify; color: #FFFFFF; font-family: Verdana; font-size: 12px; line-height: 130%; } #rightnav p { margin: 0; padding: 0; color: #FFFFFF; font-family: Verdana; font-size: 10px; } #leftnav hr, #content hr, #rightnav hr { color: #FFFFFF; height: 1px; } #content h2 { color: #FFFFFF; font-family: Verdana; font-size: 12px; } #content h2.center { text-align: center; color: #FFFFFF; font-family: Verdana; font-size: 12px; } #leftnav h2, #rightnav h2 { text-align: center; margin: 0; color: #FFFFFF; font-family: Verdana; font-size: 12px; } #content h6, #leftnav h6, #rightnav h6 { text-align: center; margin: 0; padding: 1em; color: #FFFFFF; font-family: Verdana; font-size: 8px; } #navcontainer ul { list-style-type: none; text-align: left; padding: 0 0 0 1.25em; margin: 0; } #navcontainer ul li a { background: transparent url(images/list_off.gif) left center no-repeat; padding-left: 15px; text-align: left; font: normal 10px Verdana; text-decoration: none; color: #FFF; } #navcontainer ul li a:hover { background: transparent url(images/list_on.gif) left center no-repeat; color: black; } #navcontainer ul li a#current { background: transparent url(images/list_active.gif) left center no-repeat; color: #666; } And here is snippet of code where the adsense ad is located: Code: <div id="container"> <div id="top"> <? include("ssi/header.inc"); ?> </div> <div id="leftnav"> <? include("ssi/leftnav.inc"); ?> </div> <div id="rightnav"> <? include("ssi/rightnav.inc"); ?> </div> <div id="content"> ad = rightnav.inc I have started creating a new DIV layout for my website but can't seem to get it to function correctly. I finally got the DIVs to expand with whatever content is in them, but now they will only span to the height of the window and hide the rest of the content instead of expanding further and just making the IE window scroll. Maybe one of you guys can help me out? Here is the test page: well apparently I can't post the url, so I guess I'll just "say" it. juicyart dot net / test.html Hi, I'm working on a website with a header and footer. I want the footer to sit at the bottom of the page even when the content is shorter than the page. I got that to work but can't seem to get the content div to stretch to meet the footer. The background color is different so I need it to stretch down the page. The website is here http://www.tcglv.com/3dgweb/index2.html Here's the css... I'd appreciate it if anyone can see what i'm missing here... Code: * { padding:0; margin:0; } html,body { font-family: Arial, Helvetica, sans-serif; font-size: .8em; background-image:url(../images/gradient.jpg); background-attachment: fixed; color:#4F4F4F; margin:0; padding:0; height:100%; } a { color: #0A2A57; text-decoration:none; } a:visited { color: #000; text-decoration:none; } a:active, a:focus { border-style: none; text-decoration:none; } #wrapper { background-image: url(../images/gradient_interior.jpg); width: 955px; text-align:center; margin: 0 auto -88px; position:relative; height:auto !important; /* real browsers */ height:100%; /* IE6: treaded as min-height*/ min-height:100%; /* real browsers */ } #header { background-image: url(../images/header.png); background-repeat:no-repeat; width:907px; height:215px; margin:0 auto; font-size:0.85em; color:#ffffff; text-align:right; } #header_interior.interior { margin-top:27px; } #header.interior { height:136px; } #header ul { padding-top:2px; } #header li { display:inline; padding-left: 10px; padding-right:15px; background: url(../images/bullet.jpg) no-repeat left center; } #header li.end { padding-right:36px; } #header a:link, #header a:visited, #header a:active { color:#ffffff; text-decoration:none; font-weight:normal; } #header a:hover { text-decoration:underline; } #header_interior { float:left; text-align:left; height: 210px; position: absolute; left: auto; top: 0; } #logo { float:left; position: relative; z-index: 10; } #topnav { padding-top:5px; position: relative; z-index: 10; float: right; left: auto; } #main { width:901px; background-image:url(../images/main_back.png); background-repeat:repeat-y; background-position:left; margin:0 auto; padding-left:4px; padding-right:3px; } #main_interior, #main_interior2 { background-image:url(../images/gradient_grey.jpg); background-color: #fff; background-repeat: repeat-x; text-align:left; padding:25px 25px 25px 25px; background-position: left -20px; } #menu { width:908px; background-image:url(../images/menu_back.png); background-position:left; margin:auto; text-align: center; } #menu a { margin-left: -4px; } #footer a { color:#4F4F4F; text-decoration:none; font-weight:normal; } #content { padding-bottom:98px; } #logos { text-align:center; } #footer { width:843px; height:73px; background-image:url(../images/footer_back.png); background-repeat:no-repeat; margin:0 auto; text-align:left; padding:15px 30px 30px; color:#6D6D6D; font-size:0.8em; position:absolute; bottom:0; left:20px; } #footer a { color:#888888; } #footer ul { list-style: none; margin-bottom:7px; } #footer li { display:inline; background-image:url(../images/border.jpg); background-position:right 3px; background-repeat:no-repeat; padding-right:18px; margin-right:17px; } #footer li.end { padding: 0; margin:0; background-image:url(../blank.gif); } #iii { float:right; margin-right:-20px; padding-top:12px; height:30px; } .learn { margin-top:30px; } .padding { margin-right:50px; } .padding_2 { padding-right:15px; } .padding_3 { padding-bottom:16px; } .padding_4 { padding-top:10px; padding-bottom:10px; } .padding_5 { padding-top:10px; padding-bottom:5px; } .clear { clear:both; height:0; } p { margin-bottom:15px;margin-top:15px; } h1 {font-size:16px;} .topnavul { float: left; margin-left: 195px; width: 250px; } .style3 {font-size: 12px} .style5 { font-size: 16px; color: #FF0000; font-weight: bold; } body,td,th { font-size: 0.8em; } Hey gang, I'm sure this has been asked many times, but i cannot find the words to search for this. Luckily, I'm sure it is a quick fix. I'm not great with CSS, but I feel I have a strong understanding. However, I must not completely understand divs, because when I try to add padding to this "right content" div, it pushes itself behind the footer div (the bright green box): The box on the left is the "left-content", the box on the right is "right-content." Each of the boxes are floated left and right, respectively, and they are both in a "container" div that centers them. How can I make the footer div just be pushed down with content is added to either the right/left-content div? I can add a bunch of "<br />s after the last bit of content, and the footer moves down, but I feel it is cleaner to just add 20x padding. Any help is greatly appreciated! Dear all, IE problems trying to get a large amount of content to sit in a smaller div with overflow set to auto. In FF it works perfectly, but in IE the outer div ignores the width value I have set and instead expands to the width of the content. My code: Code: <div id="calendarWrapper" style="width:800px;height:600px;overflow:scroll;"> <div style="width:4000px;height:1000px;overflow:auto;background-image:url(img/calendarBackground.gif);position:relative"> <div style="background-color:#FFFFCC;position:absolute;top:76px;left:150px;width:1000px;height:74px;">Test</div> <div style="background-color:#FFFFCC;position:absolute;top:151px;left:300px;width:750px;height:74px;">Test</div> <div style="background-color:#FFFFCC;position:absolute;top:1px;left:75px;width:100px;height:74px;">Test</div> </div> </div> I found a couple more threads similar to this but none with a solution. any help most appreciated. Mark I have a page whose outer-most container has a fixed width. On some pages, there is a table whose width I cannot set to be fixed because its contents (more specifically the number of <td>s) are dynamic. My problem is that when the table has so many <td>s that its width is forced to be greater than its parent <div>'s fixed width, the other page elements are not rendered as desired. Here is a simple illiustration of what I'm talking about. The text on the page explAins my issues (although it should be evident from loooking at it in a browser). 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test</title> <style type="text/css"> body { font-family: Arial, Helvetica, sans-serif; } #outer { width: 950px; min-width: 950px; background-color: #fc0; } #hdr { background-color: #66c; height: 50px; padding: 10px; color: #fff; margin-bottom: 25px; } table#data1 { background-color: #eee; margin: 10px; } table#data1 td { font-weight: bold; } </style> </head> <body> <div id="outer"> <div id="hdr"> This box should span the entire width of its orange container box even if the orange box's width exceeedes the width of the browser window due to the content it contains. </div> <table id="data1" border="1"> <tr> <td colspan="24"><p>This table has a lot of TDs which causes its width to go beyond both the 900px assigned to its containg DIV as well as the width of my browser window. My desired behaviours a </p> <ol> <li>the containing element would expand to the width of the table (meaning that the orange background will be displayed behind the content of the grey table)</li> <li>the DIV with the blue background at the top would also expand to the width of its parent container (the DIV with the orange background)</li> </ol> <p>Neither of these are happening in Mozilla and only #1 is happening in IE.</p> <p>I'm sure that Mozilla is displaying properly per the CSS spec, but there must be a way to acheive what I'm trying to do.</p></td> </tr> <tr> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>bbbbbbbbbbbbbbbbbbbbbbbb</td> </tr> </table> </div> </body> </html> I'm not saying my code is correct and that the browsers are not displaying it properly. I know I'm doing something wrong, I just can't figure out what. Any suggestions? I need to center the contents of two divs in one of my sidebars. The page can be seen he http://dev.asbco.com I need to center the free quote image and also the tabbed section beneath it. Any help is greatly appreciated as I'm trying to launch this site by the end of the week. Thanks! HI hope someone can help me with this its been driving me mad for a couple of days now. Have desiged a site with css layout but I want to center it in a page so when I resize the browser window it will stay in the middle of the page. I know its a bit long winded but I would greatly appreciate the help. I've used the css sheet and html bellow Thanks ---------------------------css--------------------------------- body { text-align: center; background-color:#000000; } #container { margin-left: auto; margin-right: auto; width: 65em; text-align: left; } #pageContent { height: 100px; width: 100%; background-color:#000000; border:solid #000000 thin; } /*Headings*/ h1{ } h2{ font-size:16px; font-weight: bold; color:#ff0000; padding-left: 0em; } h3{ } /*Div id's*/ /* --------------------------------------------------title------------------------------------------------------- */ #title { position:absolute; width: 429px; height: 162px; left: 194px; top: 25px; z-index:1; } /* --------------------------------------------------titleImage------------------------------------------------------- */ #titleImage { position:absolute; width: 358px; height:180px; left: 670px; top: 7px; z-index:2; } /* --------------------------------------------------navLeft------------------------------------------------------ */ #navLeftContainer { position:absolute; top: 188px; left: 194px; width: 154px; height: 405px; background-color:#ffffff; z-index:3; } #navLeft { position:absolute; top: 2px; left: 3px; width: 145px; height: 395px; background-color:#FFFFFF; border: solid #cccccc 2px; overflow:auto; } /* #navLeft ul { list-style:none; padding-top: 0em; padding-left: 0em; } #navLeft li { padding-bottom: .2em; } #navLeft a { text-decoration:none; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#999999; font-weight:800; } #navLeft a:hover { color:#ff0000; } /* --------------------------------------------------navTop------------------------------------------------------ */ #navTop { position:absolute; top: 188px; left: 346px; width: 670px; height: 24px; background-color:#000000; font-family: Arial, Helvetica, sans-serif; border: solid #ff0000 2px; overflow:hidden; z-index: 4; } #navcontainer { padding: 0; height: 22px; } #navcontainer ul { border: 0; margin: 0; padding: 0; list-style-type: none; text-align: center; } #navcontainer ul li { display: block; float: left; text-align: center; padding: 0; margin: 0; } #navcontainer ul li a { background: #000000; width: 223px; height: 24px; border-top: 0px solid #000000; border-left: 0px solid #000000; border-bottom: 0px solid #000000; border-right: px solid #000000; padding: 0; margin: 0 0 10px 0; color: #ffffff; text-decoration: none; display: block; text-align: center; font: normal 16px/18px Arial, Helvetica, "Lucida Sans Unicode", verdana, lucida, sans-serif; } #navcontainer ul li a:hover { color: #ffffff; background: #ff0000; } #navcontainer a:active { background: #c60; color: #fff; } #navcontainer li#active a { background: #c60; border: 1px solid #c60; color: #fff; } /* --------------------------------------------------navBargains-------------------------------------------------- */ #navBargainsContainer { position:absolute; top: 594px; left: 194px; width: 154px; height: 158px; background-color:#ffffff; z-index:5; } #navBargains { position:absolute; top: 0px; left:2px; width: 146px; height: 150px; background-color:#000000; font-family: Arial, Helvetica, sans-serif; border: solid #ff0000 2px; overflow:auto; padding-left: 0px; color: ff0000; } /* -----------------------------------------------------contents---------------------------------------------------- */ #contents { position: absolute; left: 348px; top: 217px; width: 672px; height: 535px; background-color: #FFFFFF; overflow:auto; z-index:6; } #triangle { position: absolute; right: 0px; bottom: 0px; z-index:7; } /* -----------------------------------------------------html------------------------------------------------------*/ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "(URL address blocked: See forum rules)"> <html xmlns="(URL address blocked: See forum rules)"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <!-- ****************************************************title******************************************* **** --> <div id="title"> <img src="test/images/Dark-Logo.jpg" /> </div> <!-- ****************************************************titleImage************************************** ********* --> <div id="titleImage"> <img src="test/images/titleImage.jpg" width="353" height="180" /> </div> <!-- ****************************************************navLeft***************************************** **** --> <div id="navLeftContainer"> <div id="navLeft"> <h2>Menswear</h2> <ul> <li><a href="linked.htm">Jackets </a></li> <li><a href="linked.htm">Jeans</a></li> <li><a href="linked.htm">T-shirts</a></li> <li><a href="linked.htm">Polos</a></li> <li><a href="linked.htm">Jumpers</a></li> <li><a href="linked.htm">Hodies & Sweats</a></li> </ul> <h2>Womenswear</h2> <ul> <li><a href="linked.htm">Going out Tops </a></li> <li><a href="linked.htm">Day Tops</a></li> <li><a href="linked.htm">Shirts & Blouses</a></li> <li><a href="linked.htm">Jeans & Denim</a></li> <li><a href="linked.htm">Knitwear</a></li> <li><a href="linked.htm">Polos</a></li> </ul> </div> </div> <!-- ****************************************************navTop****************************************** **** --> <div id="navTop"> <div id="navcontainer"> <ul id="navlist"> <li id="active"> <li><a href="#" id="current">Menswear</a></li> <li><a href="#">Womenswear</a></li> <li><a href="#">Junior</a></li> </ul> </div> </div> <!-- ****************************************************navBargains************************************* **** --> <div id="navBargainsContainer"> <div id="navBargains"> <h2>Items in Focus</h2> <ul> <li id="active"><a href="#" id="current">Item one</a></li> <li><a href="#">Item two</a></li> <li><a href="#">Item three</a></li> <li><a href="#">Item four</a></li> </ul> </div> </div> <!-- ****************************************************contents**************************************** ***** --> <div id="contents"> <div id="triangle"> <img src="test/images/triangle.gif" width="55" height="55" /> </div> </div> </div> </body> </html> /* Links End */ Hi I'm having a bit of trouble with a DIV/CSS layout - 2 DIVs are inside a 100% height 100% width container DIV. The first (top) DIV is the content and the second (bottom) DIV being a 100% width 240px height footer DIV. I can make the footer stick to the bottom of the page and display fine no problem, however, I am having trouble getting the content div to fill only the area above the footer. If I specify a 100% height for it then it extends the entire height of the page and content disappears behind the footer. Plus, I want to absolutely center the content in the space above the footer, not the absolute center of the whole page, which is all i am acheiving with 100% height! Basically, I need the content DIV to extend 100% then subtract the 240px height of the footer - I suspect it's not wise to mix px and %, however. I have attached an image to help with my probably confusing explanation! I do have a workaround using tables, which I would ideally like to avoid, particularly as it does not support IE6/7 browsers. If a solution can be acheived which uses JavaScript to format the DIVs, then I am open to any suggestions anyone may have. Thanks R Hi guys, I recently redeseigned my site using CSS from tables. When the window (IE) was made smaller before, the content would stay put but you just wouldnt see it all (obviously cause now the window is smaller) but with CSS it dumps it at the very bottom of the screen and leaves my content area totally blank. Is there some way this can be fixed? Daragh I actually have two problems... Installing hte firebug plugin for firefox may ease helping me out... The problem is with http:// kthxbai2u<dot>com I cant for the life of me center the "content" div. I have tried every method I found on the first 4 pages of Google. The only thing I can think of is that it is inheriting something wierd or I am missing something simple... The second problem, I can't seem to make the left and right side bar expand to meet up with the footer wayy down at the bottom of the page. I want that div to make a column the whole way down. If anyone can help me out, it would be more than appreciated! Thanks I am using the following code how do I change it so that it would show up in the center of the brower window? Thanks Tim PHP Code: <div style="position: absolute; left: 0px; z-index: 1; top: 0px; align: center\"> <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0 ,0\" width=\"544\" height=\"396\" id=\"cardio\" align=\"middle\"> <param name=\"allowScriptAccess\" value=\"sameDomain\" /> <param name=\"movie\" value=\"ads/cardio3.swf\" /> <param name=\"loop\" value=\"false\" /> <param name=\"quality\" value=\"high\" /> <param name=\"wmode\" value=\"transparent\" /> <param name=\"bgcolor\" value=\"#ffffff\" /> <embed src=\"ads/cardio3.swf\" loop=\"false\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"544\" height=\"396\" name=\"cardio\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> </object> </div> ive been at this for a while now. i have a navleft.gif, navbody.gif, and navright.gif. what i want to do is make an expandable nav bar with the body repeating on the x axis. every attempt ive made doesnt work. im still fairly new to css. should i have a <div id="nav"> and within this div put a another div with id=navleft and another with navright? no idea how to go about this. any help would be appreciated. Hello. Trying to construct a page with vertical expansion on both of two nested DIVs. Left column is primarily text which varies in length. Right column is a navigation/contact panel that is mostly fixed height, but want ability to drop in objects and expand vertically on some pages. I have tried to background image in container DIV, but I am still getting the content breaking out of the bottom of the DIV. Any other approaches? Min-height (could not get that to work either). Ideally I would like for these to have the same height. Not shading, so it doesn't need to be exact. Here's a sample of code (w/o all the junk). hi, Im making a site, and i decided to use CSS instead of tables. I have used basic CSS before, but it gets abit harder when i start making boxes etc. Here is my code so far - layout.css - (one that gets included on each page) Code: @import "style.css"; body { margin:10px 10px 0px 10px; padding:0px; } #leftcontent { position: absolute; left:10px; top:50px; width:200px; background:#fff; border:1px solid #000; } #centercontent { background:#fff; margin-left: 199px; margin-right:199px; border:1px solid #000; voice-family: "\"}\""; voice-family: inherit; margin-left: 201px; margin-right:201px; } #shoutbox { position: absolute; right:10px; top:50px; width:200px; background:#fff; border:1px solid #000; } #rightcontent { position: absolute; right:10px; top:50px; width:200px; background:#fff; border:1px solid #000; } #banner, #footer { background:#fff; height:40px; border-top:1px solid #000; border-left:1px solid #000; border-right:1px solid #000; voice-family: "\"}\""; voice-family: inherit; height:39px; } #footer { background:#fff; height:40px; border-bottom:1px solid #000; border-left:1px solid #000; border-right:1px solid #000; voice-family: "\"}\""; voice-family: inherit; height:39px; } #banner h1 { font-size:16px; padding:10px 10px 0px 10px; margin:0px; } #shoutbox, #rightcontent p { font-size:10px } style.css - text formatting etc. Code: body { font: 12px/1.2 Tahoma; background:#ddd; padding:0px; margin:0px; } a { text-decoration:none; font-weight:bold; color:#c00; } pre { font-size:11px; color:blue; } ol { margin-right:40px; } li { margin-bottom:10px; } p,h1,pre { margin:0px 10px 10px 10px; } h1 { font-size:14px; padding-top:10px; } it produces a good layout, with a header, 3 coloums and a footer. whoever, the boxes expand at different rates and the footer doesnt move down. the header also doesnt expand. i know how i can fix this, but i dont know how to fix it without making it so that its locked at a resolution. i would like the site to exapand as the window is made larger. here is an image of what i get - and this is what i am aiming to acheive - as you can see, i want all the boxes to be the same length, which is defined by the size of the largest box. also, i want to create 2 or more boxes on the left, only the bottom of which gets made longer. on the first image you cannot see the extra box because it is covered by the other one :-/ i would be greatful for any help you guys can provide me thanks, dynamyt Hi, I am trying to make a website for a friend that scales to fit most monitors. The website is very image heavy and I have a navigation bar on the left side that lines up with the background on the right. I haven't made a webpage for awhile so I don't know a lot about CSS. This is what I have so far. It almost works, but the background on the right will not expand to fit the full div, only goes up to the content that I put inside the Div. The background also doesn't appear to shrink when I scale the window size. HTML CODE: Code: <head> <link rel="stylesheet" href="style.css" type="text/css"/> <title>Test Page</title> </head> <body> <div id="sample-container" align="center"> <div id="header"> <img src="images/header.jpg" width="1647" height="147" / id="headerbar"></div> <div id="nav"> <img src="images/navbar.jpg" width="413" height="776" / id="navbar"></div> <div id="content"> <img src="../../../Pictures/Misc/101_0138.JPG" width="527" height="428" /> </div> <div id="footer"></div> </div> </body> </html> CSS CODE: Code: #header { height: auto; background-color: #666; } #nav { float: left; width: 25%; height: auto; background-color: #999; margin-bottom: 10px; } #content { float: left; width: 75%; height: auto; background: url(images/mountain.jpg); background-repeat: no-repeat; margin-bottom: 10px; } #footer { clear: both; height: 50px; background-color: #666; margin-bottom: 10px; } #headerbar { height:auto; width:100%; } #navbar { height:auto; width:100%; } If anyone knows a way to expand the background to fill the div and scale down when the div scales is size, that would be great. I was also thinking that maybe I could put the the navigation bar and the background image on the page and not as an background. Put those both in a div and have a floating div on the right aligned over the top of the background that contains the page content. If anyone could give any help with a solution it would be appreciated. Thanks. Hey guys, I've got a two column layout, and I want both columns to be the same height inside the wrapper. Ussually when I do this sort of thing I have a repeating background image or something so it makes it appear they are both the same height, except this template is using rounded corners, so a repeating background won't work. Code: #wrapper{ width:962px; margin: 25px auto; } #mainContent{ width:735px; background-color: #F4FEFE; padding:0px; border:0px; float:left; } #rightColumn{ background-color: #F4FEFE; width:207px; height:100%; min-height:100%; float:left; margin-left:20px; } Click here to see what I'm talking about... I want that right column to match the height of the main content div. Would this only be possible using JavaScript or is there a CSS solution? going bonkers, I have tried everything to find out why on earth the background goes all the way to the right when this page is viewed in IE.. Black Background Not Stoping!! Hi there I have a container DIV that nests 4 DIVs one on top of the next (logo, navigation, content and footer, all the same widths). If there is a single paragraph (or small amount) of text in the content DIV of the page, the page looks fine. However, if there is a large amount of text in the content DIV of the page, the width gets pushed out slightly. IE5 is fine. Firefox and Opera are the problem. Note: I have left the height of the content DIV blank as it will be of varied size. When I set a height of say, 500px, the page looks fine (but because a background colour is needed for the DIV, it doesn't appear as I intended it to). Any ideas to why this is happening? Thanks in advance :-) -Solange. |