CSS - Css Height Problems
Trying to hone my CSS skills, but as usual I'm having trouble with the height property. The page is buzzdphoto dot com / times and you should notice part of the white containing box does not extend to the bottom of the page as it should, instead the content falls past it. I've viewed it in both Firefox 3.5 and IE8 and am getting similar results with both. Any ideas?
Similar Tutorialsi am working on a practice web site and im having problems. i set the #document div set to min-height:400px; but then the when i input content that overpasses 400px in the col div it goes over the footer div. and if in #document i set height to a specified height it works but then i have to do that for every page specifically. i hope you can help and i explained it ok. here's the code p.s. it works fine in IE go figure but not in FF or chrome i thought that #document would increase in height automatically as #col increased 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=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="9.css" /> </head> <body> <div id="Document"> <div id="Header"> <div id="Top_Right"> <ul> <li><a href="#">Terms of Use</a></li> <li><a href="#">Privacy Use</a></li> </ul> </div> <div id="Logo"><a href="#"><img src="Images/guitar102.png" alt="guitar102" /></a></div> </div> <div id="Nav"><ul> <li><a href="#"><img src="Images/home.png" /></a></li> <li><a href="#"><img src="Images/links.png" /></a></li> <li><a href="#"><img src="Images/about.png" /></a></li> <li><a href="#"><img src="Images/contact.png" /></a></li> </ul> <hr /> </div> <div id="Side_Nav"> <ul> <li><a href="#"><img src="Images/less.png" /></a></li> <li><a href="#"><img src="Images/art.png" /></a></li> <li><a href="#"><img src="Images/his.png" /></a></li> <li><a href="#"><img src="Images/news_.png" /></a></li> <li><a href="#"><img src="Images/ad.png" /></a></li> </ul> </div> <div id="Col"> <div id="Column1"> <p>Content goes here. Content goes here.</p><p>Content goes here. Content goes here.</p> <p>Content goes here. Content goes here.</p><p>Content goes here .Content goes here.</p> <p>Content goes here.Content goes here.</p> <p>Content goes here .Content goes here.</p><p>Content goes here .Content goes here.</p> </div> <div id="Column2"> <p>Content goes here. Content goes here.</p><p>Content goes here. Content goes here.</p> <p>Content goes here. Content goes here.</p><p>Content goes here Content goes here.</p> <p>Content goes here.Content goes here.</p> <p>Content goes here. Content goes here.</p><p>Content goes here. Content goes here.</p> </div> <div id="Column3"> <p>Content goes here.Content goes here.</p><p>C ontent goes here.Content goes here.</p> <p>Content goes here. Content goes here.</p><p>Content goes here.Cont ent goes here.</p> <p>Content goes here.Content goes here.</p> <p>Content goes here. Content goes here.</p> <p>Content goes here.Cont ent goes here.</p> <p>Content goes here.Content goes here.</p> <p>Content goes here. Content goes here.</p> <p>Content goes here.Cont ent goes here.</p> <p>Content goes here.Content goes here.</p> <p>Content goes here. Content goes here.</p><p>Content goes here.C ontent goes here.</p></div> </div> </div> <div id="Footer"> <div id="Top_Fot"></div> <div id="Fot"></div> <div id="Bot_Fot"></div> </div> </body> </html> Code: /* CSS Document */ Body{ background-color:#000000; font-family:Georgia, "Times New Roman", Times, serif; color:#FFFFFF; margin:0px; padding:0px; } h1{ margin-left:20%; } a { text-decoration:none; color:#FFFFFF; } a:hover { text-decoration:none; color:#FFFFFF;} #Document { background:url(Images/1.jpg) repeat-y; background-color:#310606; color:#FFFFFF; height:700px; width:1005px; } #Header { height:154px; background-color:#310606; margin:0px; padding:0px; float:left; width:1005px; background:url(Images/header4.png) no-repeat; } #Logo { margin:0px 0 0 5px; height:120px; width:200px;} #Logo img{ border-style:none;} #Top_Right { margin:0px; padding:15px 10px 0 0; height:100px; width:150px; float:right; } #Top_Right ul { list-style:none; } #Top_Right ul li{ margin:5px 0 0 0;} #Col { margin:5px 0 0 120px; float:left; text-align:justify; padding:10px 10px 10px 10px; width:780px;} #Column1{ float:left; width:280px; margin:0 30px 0px 0; } #Column2{ float:left; width:210px; margin-right:30px;} #Column3{ float:left; width:150px;} #Nav{ width:640px; height:60px; float:left; margin:0 40px 0 125px; padding:0px 0 0 60px; } #Nav ul{ margin:0px 0 0 0px; padding:0px 0 0 5px; } #Nav ul li{ display:inline; margin:0px; padding-left:20px; list-style:none; } #Nav ul li img { border-style:none;} #Nav ul li a{ color:#310606; text-decoration:none;} #Nav ul li a:hover{ color:#310606; text-decoration:none;} #Side_Nav { height:400px; position:absolute; top:156px; left:0px; width:120px; padding:0px 0 0 0px; margin:2px 0 0 0px; } #Side_Nav ul { margin:0px; padding:0px;} #Side_Nav ul li{ display:inline;} #Side_Nav ul li img{ border:none; margin:0px; padding:0px;} #Footer { background-color:#000000; margin:0px; padding:0px; width:1005px;} #Fot { width:98%; height:50px; padding:10px 10px 10px 10px; background-color:#310606;} #Top_Fot { height:11px; background:url(Images/footer_start.jpg) repeat-x;} #Bot_Fot { height:24px; background:url(Images/bottom.jpg) bottom no-repeat;} Hello, Two questions, The first is that I am struggling to get my head round making the min-height work on my page. My page is at http://www.garethgroup.com/test/floatcolumnsattempt/index.html. This is not a commercial website but more of a website of attempted collaborations. I am also wondering if there is a quicker way of opening divs - for example, can you use div id's like this - Code: <div id="div1" "div2" "div3"> Thanks and Kind Regards, Ben. hey.. i have a webdesign _Link here_ but i need it to look like this _picture_ but i can't get the gradient background height: 100%; the borders and content box do i need to get height: 100%; too something like my personal homepage i am new to css designin... plz help me.. my code is this 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>Untitled Document</title> <style type="text/css"> <!-- body { margin: 0px auto; text-align: center; height: 100%; } #container { margin: 0px auto; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 1; } #top_bg{ margin: 0px auto; left: 0px; top: 0px; width: 100%; height: 151px; z-index: 2; background-image:url(images/topbg.gif); } #top { margin: 0px auto; left: 0px; top: 0px; width: 701px; height: 100px; z-index: 3; background-image:url(images/top.gif); } #menu_knapper{ float: right; z-index: 4; height: 30px; width: 60px; top: 100px; } #menu { margin: 0px auto; z-index: 5; height: 51px; width: 701px; top: 100px; background-image:url(images/menu.gif); } #content_bg { margin: 0px auto; z-index: 6; height: 100%; width: 100%; top: 151px; background-image:url(images/bg.jpg); background-position: top right; background-repeat: repeat-x; } #logo { margin: 0px auto; background-image:url(images/logo.gif); width: 701px; height: 114px; z-index: 7; left: 29px; top: 151px; } #content { margin: 0px auto; width: 701px; height: 100%; z-index: 8; top: 265px; } #left_border { margin: 0px auto; width: 30px; height: 400px; float: left; background-image:url(images/left_border.gif); } #right_border { margin: 0px auto; width: 30px; height: 400px; float: right; background-image:url(images/right_border.gif); } #content_indhold { margin: 0px auto; width: 641px; float:left; height: 400px; background-color: #FFFFFF; } #left_footer { margin: 0px auto; width: 30px; height: 30px; float: left; background-image:url(images/left_footer.gif); } #right_footer { margin: 0px auto; width: 30px; height: 30px; float: right; background-image:url(images/right_footer.gif); } #footer { margin: 0px auto; width: 641px; float:left; height: 30px; background-image:url(images/bottom_border.gif); } --> </style> </head> <body> <div id="container"> <div id="top_bg"> <div id="top"> <div id="menu_knapper">menu</div> </div> <div id="menu"></div> </div> <div id="content_bg"> <div id="logo"></div> <div id="content"> <div id="left_border">pik</div> <div id="content_indhold">dut</div> <div id="right_border">tis</div> <div id="left_footer">pik</div> <div id="footer">dut</div> <div id="right_footer">tis</div> </div> </div> </div> </body> </html> Hi, I'm developing the following site and am having some issues with spacing and heights. The first and major problem is in Firefox. As you will see at the bottom, my content "grows" out of it's wrapper div for some reason. It works great in IE, where the height of the content will determine how high both the side and main columns are. The second problem is in IE. There is too much space between the menu and the image above it. I want it to be flush to the image, as it is in Firefox. How can I go about solving these two issues? i have a page that changes size depending on what is inside it... but i want to set a default size, and if the data goes over that default size, i then want it to autostretch... i think IE will do this... but Firefox will not, it just keeps the set height, and flows the data outside of the div container Hi guys, I am struggling a bit with getting the background of one of my css-created columns to be the height I want it to be. If you have a look at http://www.addictivemedia.com.au/clients/REW/ you will see (depending on your browser) that the left column behaves not the way I want it to: - in IE 6 it creates an additional scrollbar (because it adds the height of the banner at the top to the 100% height I gave to the column) - in all other browsers it is not as long as the column on the right The effect I want to achieve is of course for both columns to have the same height and (if possible) to always push the footer to the bottom of the browser window. I have tried the pushing to the bottom many times and out of previous posts I gather that it probably won't happen for all browsers. But I cannot figure out why the left column doesn't extend as far as the right one. Thanks for your help! Link: bitbonton [dot] com For some odd reason, the %100 height on the left column does not seem to work ... the dotted line ends after the content. Also, there is another problem where if the scroller bar appears on the right because the content is too long, it pushes everything leftward. tried to move the content a bit more to the left, but it seems to remain centered? Thank you for your help! Hello, I'm new to these forums and I have a question. I am making a website (c-pj.net/lowercase/), and I'm having a problem. If I add too many posts or make a post to long it goes off the page, or at least the text does. What I mean by that is that the text ends up going onto the header and past my content holder image. Can anyone take a look at the source code, and my style sheet and tell me how I could make the height of my content area scale to the proper size, when I try to set it to auto it doesn't display at all. This could be caused by the fact that my content are is absolutely positioned but I'm just looking for some advice hopefully you guys understand my question. My style sheet is located he c-pj.net/lowercase/stylesheets/default.css Hi i have a content div inside a container div, the content in the content div stretches automatically but the container div doesnt stretch to accomodate the bigger content div....is it possible to get it to stretch the same as the content? the only solution ifound was to fix the height and set the overflow to auto so that i get a scroll bar but that looks rubbish ;o( cheers Andy Hi, It seems I just can't get away from the height: 100% problems. I tryed making my body 100% and my container min-heaight 100% but that didn't work. I'll post the index and css below. I also want there to be a 15px space between each box 'lightbox, lightbox2, topbox, bottombox.. (they aren't spacing at all?) www.carbenco.com/resume/ index Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Terry Cantwell - Resume</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" title="default" /> </head> <body> <div id="container"> <div id="topbox">Hi</div> <div class="lightbox">Hi</div> <div class="lightbox2">Hi</div> <div class="lightbox">Hi</div> <div class="lightbox2">Hi</div> <div class="lightbox">Hi</div> <div class="lightbox2">Hi</div> <div class="lightbox">Hi</div> <div id="bottombox">Hi</div> </div> </body> </html> css Code: body { margin: 0px; padding: 0px; text-align:center; background-color: #3F3727; font-size: 10px; font-family: Arial, Helvetica, sans-serif; height: 100%; } #container { position: relative; top: 0px; margin-left: auto; margin-right: auto; text-align:center; width: 600px; height: 100%; background-color: #E9E4DC; } #topbox { position: relative; top: 15px; margin-left: auto; margin-right: auto; text-align:left; width: 450px; padding: 5px; background-color: #e9e4dc; } .lightbox { position: relative; top: 15px; margin-left: auto; margin-right: auto; text-align:left; width: 450px; padding: 5px; background-color: #B1A283; } .lightbox2 { position: relative; top: 15px; margin-left: auto; margin-right: auto; text-align:left; width: 450px; padding: 5px; background-color: #9B8862; } #bottombox { position: relative; top: 15px; margin-left: auto; margin-right: auto; text-align:left; width: 450px; padding: 5px; background-color: #e9e4dc; } Below is what I have. Displays fine in FF. In IE, there is approximatly a 13px white space under the image. Can't find an answer to this. Any insight is appreciated. --Sean HTML: <p id="dot"></p> CSS: #dot { position:relative; left: 0px; top: 0px; width:200px; height:6px; background-image: url(dot.jpg); background-repeat: repeat-x; line-height:0pt; margin: 0px; } I have a div that just serves as a horizontal rule, it's 800px wide and 3px high. Firefox renders it properly, but internet explorer is adding 10 pixels totaling 13 pixels high. I have tried the traditional <hr> tag, but it adds an ugly subtle border around it in IE that can't be removed. EDIT: sorry, I forgot to mention that it's internet explorer version 6 The markup: Code: <div id="header"> <div id="banner"> </div> <div id="nav"> <div id="floatleft"> </div> <div id="floatright"> </div> </div> </div> <div id="header_hr"> </div> <div id="main"> </div> The CSS: Code: #header { margin:0 auto; width:800px; font-size:11px; } #banner { background-image:url('../images/banner.jpg'); height:29px; width:800px; } #nav { width:800px; } #floatright { float:right; } #floatleft { float:left; } #header_hr { background-color:#464646; clear:both; height:3px; margin:0 auto; width:800px; border:0; } #main { width:800px; margin:0 auto; } Here's the output: I have spent more than 6 hours researching and reading to solve these two problems. I have included a complete example in one file to assist others in helping me quickly and easily. Just copy to an HTML file and examine my complete issue. 1. Left black bar needs to match right-column height. 2. Image in left column needs to align to the bottom of the left bar. I tried absolute positioning the left image but it would then over-lap stuff in the left bar if the leftbar was not tall enough. In other words, it didn't take any space anymore and just covered up anything. Code: <html> <head> <style tyle="text/css"> body { width: 850px; margin-left: auto; margin-right: auto; height: 100%; background-color: #fff; color: #000; font: 11pt arial, sans-serif; } div.leftbar { width: 201px; height: 100px; /* Should Not Be Required--adding for demonstration */ margin: 0px 5px 0px 0px; padding: 0px; background-color: #000; color: #ffd600; float: left; } div.rightbar { width: 670px; margin: 0px 0px 0px 201px; padding: 4px; background-color: #fff; border: 1px solid #f00; /* Added For Visibility */ } </style> </head> <body> <div class="leftbar"> Menu (pulled in from php) <div class="search"> Search </div> <div class="leftimage"> <img src=".jpg" /> </div> </div> <div class="rightbar"> MAIN CONTENT<br /><br /><br /><br />left bar should stretch to bottom of this column.<br />Image in left column should align to the bottom of the black leftbar. I forced a height on the left bar to show it should touch the bottom (but doesn't) when the height is greater than sized for the content.<br /><br />Thanks for your help! </div> </body> </html> Can anyone tell me whether they have experienced height and overflow problems with FireFox and Mozilla browsers? Check this out: Test Page. It looks fine in IE, but not the other two. I've been working on this half the day with no solution. Can anyone help? If the problem can be solved without the use of javascript, that would be preferred. Thanks, Darin Hi all, I am trying to automate everything on my test website and I have one more angle to cover. In effect, I want to adjust the line-height property (which I can do) based on the number of files within a specific folder (PHP and already done). The more files in the folder, the lower the line-height value must be. This is to ensure if I copy additional files into the folder, then the navigation menu (which is PHP reading files in this particular folder) will alter the CSS line-height property accordingly to ensure it can never exceed a certain height. Sounds wierd? go to www.re3.org.uk (next to the RE3 image, I have a list of hyperlinks which are obtained from files within the folder) My problem, when adjusting the CSS property (which is set as cm in *.css file) in javascript, it doesn't correspond correctly, the line-height property in javascript doesn't appear to be work in cm but some other measurement. Does anyone know how to change what unit of measurement Javascript works in? Or does anyone know what unit of measurement javascript uses when adjusting line-height / line-width values? I want to create a mini-algorithm that works out the appropriate line-height based on the image height (got that already) and the number of files in the folder (got that too) so the menu automatically adjusts to fit. Whew! I've never done much CSS work, but I know this has to be an easy fix. Each DIV appears to be 10px higher when viewed in IE. I want them to be 8px high and they end up being 18px high. In Firefox, Netscape, and Opera it works fine. Anyone mind correcting this imbarrassing little problem? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>IE 10px Padding Problem</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body { margin:0px; } #container { position:relative; margin:auto; width:730px; } #header { height:110px; } .textualtop { border:1px solid #000000; height:8px; } .textualbottom { border:1px solid #000000; height:8px; } </style> </head> <body> <div id="container"> <div id="header"></div> <div class="textualtop"></div> <div class="textualbottom"></div> <div class="textualtop"></div> <div class="textualbottom"></div> <p>Notice how in IE6 each DIV is 10px higher then in FF. Why is it doing this?</p> </div> </body> </html> It seem that everytime I added the image tag, the div'x area get bigger in IE but not in Mozilla/Firefox browser. So, I thought by added the "margin-bottom:-360px;" to the div would fix it but it had an opposite effect. Meaning it worked in IE but Mozilla show a vertical scrollbar. So, does anyone know how can I make the <img> overlap one another without being stacked on one after another in height for IE if I take out the "margin-bottom: -360px;"? Thanks... Code: div.divBox1 { width: 286px; height: 359px; float: left; } div.divClearFloat { clear: both; height: 0px; /* For IE Stupidity (it added some spaces after clearing the float) */ font-size: 1pt; /* For IE Stupidity (minimum height only work with current font-size somewhere) */ } div.divDottedLineAdvertisementSeperator1 { width: 575px; height: 3px; background-color: #ff0000; font-size: 1pt; /* For IE Stupidity (minimum height only work with current font-size somewhere) */ } Code: <div class="divBox1"> <div style="margin-bottom:-360px;"> <img src="images/doctor.jpg" style="position:relative;top:0px;left:0px;z-index:2;"> <img src="images/we_help.jpg" style="position:relative;top:-360px;left:0px;z-index:1;"> </div> </div> <div class="divClearFloat"></div> <div class="divDottedLineAdvertisementSeperator1"></div> Hello everybody! I have been having a big problem with my webpage for a long time now and hope I can find an answer to my problem with your help. I want a div that contains the content of my pages (which varies in length depending on the individual page) to stretch the length of my page, but it only stretches the length of the window. Here's the HTML and CSS: HTML (I only included the very basic structure): <html> <body> <div class="container"> <div id="content"> <div id="..."></div> <div id="..."></div> <div id="..."></div> <div id="..."></div> </div> </div> </body> </html>` CSS: html, body { height: 100%; font-family: Arial; font-size: 10px; color: #000000; background: #FFF url(../../images/body.png) no-repeat center 40px; margin: 0; position: relative;} .container { height: 100%; width: 960px; margin-right: auto; margin-left: auto; position: relative;} #content { width: 939px; min-height: 100%; position: relative; top: 210px; left: 6px; box-shadow: 0px 0px 8px #666; -moz-box-shadow: 0px 0px 8px #666; -webkit-box-shadow: 0px 0px 8px #666; background-color: #FFF;} I tried to set the content div to overflow: auto, but that includes a scroll bar for the content div that I do not want. It does, however, create the desired effect of the shadow and background of the #content div all the way to the end of the page. Am I missing anything? I thought min-height would work, but it doesn't! It only stretches the content div to page height and everything else is overflow, but without the content div's background color and shadow. Does anybody maybe see where the problem lies? Thank you so much in advance for your help. Hello Just recently I had an idea for a page I wanted to make, the design is basically a 3-column layout with no traditional header or footer, the height of all three columns should run the length of the window/page height the left and rightmost column would have a fixed width or a width in em, the center column width should fill the space in between. If the content is short all columns should extend to the height of the page window, but if the content in any of the columns is longer than the window height they should all extend to reach the bottom of the page and accommodate the content length In my first attempt things didn't go so well, results varied wildly across browsers so I decided to start from scratch bit by bit Bellow is the point at which I reach consistent but undesired behaviour, I have validated and tested the code in Firefox 3/Pale Moon, Internet Explorer 8, Chromium 9, and Opera 11 I would like the end result to work in the above browsers as well as IE7 if possible I should point out now that im not interested in using faux-columns, the layout should not require images, I also wish to have absolute-positioned elements in the columns some time later Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Three Columns</title> <style type="text/css"> *, html, body { margin: 0; padding: 0; font-size: 100%; } html, body { width: 100%; height: 100%; } #maincontainer { position: relative; height: 100%; background: #eee; } #left { position: absolute; top: 0px; left: 0px; width: 200px; background: #fbb; height: 100%; } #mid { position: relative; margin: 0 200px 0 200px; background: #efe; height: 100%; } #right { position: absolute; top: 0px; right: 0px; width: 200px; background: #bbf; height: 100%; } </style> </head> <body> <div id="maincontainer"> <div id="left"> left start<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left<br /> left end<br /> </div> <div id="mid"> mid start<br /> mid<br /> mid<br /> mid<br /> mid<br /> mid<br /> mid end<br /> </div> <div id="right"> right start<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right<br /> right end<br /> </div> </div> </body> </html> In the above example it works as long as the content within the columns is shorter than the window height, but if you re-size the window so that the text in the right or left column goes beyond the page, and then scroll to the bottom, the columns do not extend to the bottom of the page so there is a large gap where the content overflows beyond the column What I would like to do from this point is make the columns extend to the bottom of the page when this happens, but I'm not sure how best to proceed I also have a version of the above code which uses floated left and right columns instead of absolute positioned ones, would it be better to work from that? or does it not really matter Thanks in advance |