CSS - Page Height Won't Stay At 100% When Window Size Decreases - Help
Similar TutorialsHello 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. i am trying to use CSS to position an embeded .swf rotating cube so that it is always at the bottom of a webpage and is unaffected by scrolling. i've managed to make it start out at the bottom but it always scrolls up with the scroll bar. i realize ie6 has trouble with fixed postioning, so i was wondering if anyone had any ideas on how to get around it without using javascript? here's my page: http://www.myspace.com/marx0i0 and here are some examples of what im trying to do: http://bonrouge.com/test/fixed.htm http://www.howtocreate.co.uk/fixedPosition.html finally, here is my code: <embed allowScriptAccess="never" allowNetworking="internal" SRC="http://www.geocities.com/marx0i0/untitled.swf" HEIGHT=200 WIDTH=200 STYLE= "position: absolute; center:0px; bottom: 0px; overflow: auto;" WMODE= "transparent"> thanks very much for any help! First of all I apologize if this is a stupid question, I am 1st year student. For the project I had to make an IT store type website. My problem is I have two div's in the container which i have positioned to be fixed at the top left of the page outside the container, this is so the user can see these div's at all times. When I make the window smaller it shrinks to the container and the div's in question appear on top of the content. I have tried styling the body with margins, padding and min-width. All I want is the page to remain the same when I re-size the window. I hope this is enough info for someone to understand my problem, i have included the css from the parent div's any help would be greatly appreciated. * { margin: 0; padding: 0; } * html #container { height: 100%; } html { height:100% !important; background-attachment: fixed; background-clip: border-box; background-color: transparent; background-image: url(../images/header/Home.jpg); background-origin: padding-box; background-position: center; background-repeat: no-repeat; background-size: cover; } body { height:100% !important; } #outer { width: 100%; height: 100%; } #container { min-height: 100%; width:940px; padding: 8px 10px; background: #000; margin:0 auto; text-align:left; font-size: 100%; overflow: hidden; } * html #container { height: 100%; } Hello, not entirely sure how to go about this, but I'm using Dreamweaver CS5 and I'm working on my home page. The way I have it set up is I have a "sidebar" to the left, then a large "main_image" to the right of that which begins my "container" div followed by some "body_copy" below that. Everything looks good when the window is in a max size. The problem arrises whenever I resize my window the main_image moves to below the sidebar and everything just seems to shift down... The main_image is set to relative so the body_copy text can form properly under it. Is there any way to have the image remain stationary despite window size? Thanks for your help!! Hello, I created the following header: http://www.27lamps.com/Beta/Typography/Typography.html Where Font Size is the same as Line Height: 2.0em. Shouldn't the border be next to the text? Thanks, Miguel My code works well in Internet Explorer and Safari but it does not work the way I want it to in Firefox and Opera. My items with red borders should always stay close to the blue bar in the background. But in Firefox and Opera the body background moves to the left when the window size is small, and the items with red borders appear to move away from the blue bar. The problem is the way in which these browsers center the background image for the body. Can anyone help me fix this issue? Thanks! 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> <title>Demo</title> <style type="text/css" media="all"> html, body { padding: 0px; margin: 0px; height: 100%; width: 100%; text-align: center; } body { background: #555 url(http://www.glidestor.co.uk/images/PageBackground.gif) repeat-y scroll 50% 0; color: #111; } #page { width: 617px; margin: 0 auto 0 auto; padding: 0 0 0 160px; text-align: left; position: relative; border: 1px solid #55aa77; } #homeFeatures { margin: 420px 0 0 0; } #homeFeatures #f1, #homeFeatures #f2, #homeFeatures #f3 { padding: 0 40px 0 12px; font-size: 9pt; font-weight: 300; width: 200px; display: block; text-decoration: none; float: left; border: 1px solid red; } </style> </head> <body> <div id="page"> <div id="homeFeatures"> <a href="#" title="Item 1" id="f1"><strong>Item 1</strong>J khfdg jkfkfhkjfsh ksh fhdk ghjkhfsdkjg hsdfjkhsdfjkkjsdf hgkjfsd hgkjfdh gkjfh kjghkjfdh kfj hkfjd hfkdjg hk jghfsdkj ghfsdjk hgfjdhg jsdfgh sdfj ghf.<span>more</span></a> <a href="#" title="Pring Design" id="f2"><strong>Item 2</strong>T khfdg jkfkfhkjfsh ksh fhdk ghjkhfsdkjg hsdfjkhsdfjkkjsdf hgkjfsd hgkjfdh gkjfh kjghkjfdh kfj hkfjd hfkdjg hk jghfsdkj ghfsdjk hgfjdhg jsdfgh sdfj ghf.<span>more</span></a> <a href="#" title="Item 3" id="f3"><strong>Item 3</strong>B khfdg jkfkfhkjfsh ksh fhdk ghjkhfsdkjg hsdfjkhsdfjkkjsdf hgkjfsd hgkjfdh gkjfh kjghkjfdh kfj hkfjd hfkdjg hk jghfsdkj ghfsdjk hgfjdhg jsdfgh sdfj ghf.<span>more</span></a> </div> </div> </body> </html> If you look at the bottom of the page at www.res-technologies_DOT_com/index.php?jos_change_template=restech2 in both IE and FF, you will see that it looks fine in IE, but in FF the page length is extended by exactly the height of the header image at the top of the page. Trying to figure out what's causing this is driving me nuts! Can anyone help? thx dh When content exceeds the window size, the fixed footer covers it. The center div has a min-width, the right div covers it when the window is resized to smaller than the min. (Also, center div drops in IE). I have googled these issues and searched the archives. I've tried many different techniques for getting these things in order, and this is the closest I've gotten so far. What I want: 1.A footer that sticks to the bottom of the viewport if there is not enough content AND stays below the container when the container is longer than the viewport. 2. The center div to be liquid with a min-fixed width and the right div to move along the edge of the center div and not cover it when viewport is sized smaller than the center div's min width. Here is a simplified version of the HTML (none of the extra divs that are used to make rounded corners) 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>Troubleshooting</title> <link rel="stylesheet" href="layout8.css" type="text/css" /> <link rel="stylesheet" href="round.css" type="text/css" /> </head> <body> <div id="header"> <div id="masthead"></div> <div id="topnav"><div class="searchbar">Search</div> <div class="homebar"><span>Home </span></div></div> </div> <div id="container"> <div id="left"></div> <div id="right"></div> <div id="content"></div> </div> <div class="clear"> </div> </div> <div id="footer"></div> </body> </html> I think there's too much CSS to post here, but everything can be found at: www. observera. com/troubleshootingpage/index. htm CSS @ layout.css and round.css I appreciate any help you can offer Em Is there a way to expand the height and width of a DIV to the height and width of the document, not the browser window? When I set it too 100%, and scroll, the div remains the size of the original window. The DIV is for a background grey out screen, and I want it to encompass the height and width of the document and persist when scrolling. Explicitly setting height and width with pixels doesn't work, because that depends on the user's screen resolution. Any thoughts? Many thanks... Hi I am trying to learn how to design and develop a website that has consistent behavior across browsers, browser window size and screen resolution. What are the industry best practices for designing and developing such websites. Your help is appreciated Thanks I am trying to get my container to be 100% the height of the browser window but have so far been unsuccessful, and I am not sure what I am doing wrong. Thanks for any help. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>TEST</title> <style type="text/css" media="all"> body { margin: 0; padding: 0; color: #333; font: 13px Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif; background: #EEEEEE; text-align: center; } a { color: #434C3E; } a:hover { color: #F15925; } #container { margin: 0 auto; width: 724px; height:100%; position: relative; background: #fff; padding: 0 10px 0 10px; text-align: left; } * html #container { width: 744px; w\idth: 724px; } #logo { position: absolute; top: 20px; left: 70px; width:94px; height:147px; background-image:url(../images/logo.gif); } h3 { color:#555555; } #top { height: 145px; margin-left:240px; } #container #intro #quickSummary .p1 { font-size: 11px; height: 171px; margin: 0; width: 724px; color: #fff; font: 12px/150% Trebuchet MS; } #container #intro #quickSummary .p1 span { padding: 30px 530px 0 30px; display: block; margin: 0; font: 12px/150% Trebuchet MS; } #text { margin: 20px 20px 0 243px; } #text p { line-height: 150%; margin: 10px 0 10px 0; } #footer { color: #fff; height: 48px; text-align: right; padding: 0 10px 0 0; line-height: 26px; font-size: 11px; } #footer a { color: #fff; text-decoration: none; } #footer a:hover { text-decoration: underline; } </style> </head> <body> <div id="container"> <div id="intro"> <div id="logo"></div> <div id="top"></div> <div id="text"> <h3>Heading number one</h3> <p class="p1">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam arcu purus, sodales volutpat, eleifend ac, semper ut, dolor. Curabitur porttitor suscipit ligula. Sed vehicula mauris non sapien suscipit luctus. Fusce luctus pulvinar lectus. Aenean mi. Pellentesque rutrum nibh ut diam. Mauris porta, lectus sit amet ultricies lobortis, metus mauris semper orci, porta tincidunt neque dui ac magna.</p> <p class="p2">Curabitur nunc. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum eu purus ac nisl vestibulum ultrices. Pellentesque lacus. Suspendisse quam risus, hendrerit sit amet, gravida non, dapibus quis, ante.</p> </div> </div> <div id="text"> <h3>Heading Number Two</h3> <p class="p1">Etiam nec metus vestibulum lacus facilisis consectetuer. Cras sed odio. Sed et purus a pede condimentum fermentum. In hac habitasse platea dictumst. Integer ornare nisl eu sem.</p> <p class="p2">Nam laoreet, eros non cursus varius, nisi enim pharetra nisi, ut fringilla nisl turpis a diam. Proin ac elit ut nibh nonummy ultrices. Phasellus felis quam, consectetuer in, bibendum et, dictum id, mi. Nunc quis eros id metus auctor volutpat. Nunc diam odio, vehicula a, accumsan a, semper quis, mauris. Ut mauris enim, ultricies sed, viverra non, porta vitae, dui.</p> <div> <h3>Heading Number Three</h3> <p class="p1">Curabitur nunc. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum eu purus ac nisl vestibulum ultrices. Pellentesque lacus. Suspendisse quam risus, hendrerit sit amet, gravida non, dapibus quis, ante.</p> </div> </div> <div id="footer">Foo</div> </div><!--end container--> </body> </html> I deleted the other posting as it take too long to work on it and it doesn't work. So, I got the other code from google search and decided to use it. There, I rearrange, redo, customzie the scripts to make it work better. Now I have one problem. See the class "wrapper" that make use of the height. I when I have it set at 100%, the footer extend too far down and the vertical scroll bar appear at the right. This is not what I want. I figure maybe it's because of the float that the browser doesn't know the real height of the header and footer. Can anyone help? I would really apppreciated it. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <style type="text/css"> body { margin: 0px; padding: 0px; width: 100%; height: 100%; background-color: #FFFF00; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ } html { margin: 0px; padding: 0px; width: 100%; height: 100%; width: 100%; } table { border: 0px solid #000000; border-collapse: collapse; border-spacing: 0px; } #columnleft { margin: 0px; padding: 0px; width: 10%; height: 100%; /* Required by IE to inherit from wrapper (IE Hack) above */ background-color: #0000FF; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position: absolute; */ float: left; } #columnright { margin: 0px; padding: 0px; width: 10%; height: 100%; /* Required by IE to inherit from wrapper (IE Hack) above */ background-color: #0000FF; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position: absolute; */ float: right; } #footer { margin: 0px; padding: 0px; width: 100%; height: 65px; background-color: #FFCC00; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position: relative; */ } #clearfooter { clear: both; } #header { margin: 0px; padding: 0px; width: 100%; height: 65px; background-color: #FFCC00; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position:relative; */ } #main { margin: 0px; padding: 0px; width: 79.8%; /* #columnleft + #main + #columnright = 100% width, but take away 0.02% for the #main due to for some browser's inaccurate mathetical rendering, such as 100.1% or 100.2% which cause the Right Column to jump to the bottom, so 99.8 % total width is better as it make the browser's glitch not be that noticeable. Just add some background color to the #wrapper so that the color can match either the #main or #columnright */ height: 100%; /* Required by IE to inherit from wrapper (IE Hack) above */ background-color: #FFFFFF; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position: relative; */ float: left; } #wrapper { margin: 0px; padding: 0px; width: 100%; height: 100%; /* min-height: 80%; */ /* Might not be needed, it's an IE Hack... */ background-color: #FF0000; border-top: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-right: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-left: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ border-bottom: 0px solid black; /* Test/Debug, otherwise leave actual table border as 0px */ /* position: relative; */ } /* IE Hack - Layout REQUIRES a height here to work */ /* * html #wrapper {height: 100%;} */ </style> </head> <body> <div id="header">Header Text</div> <div id="wrapper"> <div id="columnleft">Left Text</div> <div id="main">Center Content</div> <div id="columnright">Right Text</div> </div> <div id="clearfooter"></div> <div id="footer">Footer Text</div> </body> </html> Thanks, FletchSOD Hi everyone, Having some problems with CSS printing. I am trying to get a webpage to print in B4, no print margins, no header or footer. There is supposively a way to do this in CSS with the @page properties. I've tried the examples from the w3c site but to no avail. Does anyone have any code that definitely works for internet explorer? Thanks, Dave. Hi guys, I have a query, im trying to create the effect, that this site has. Quote: http://www.exigeinternational.com/index.htm i mean that the i want to create the effect that that site has when the page is minimised,i want each side to get smaller instead of everything moving to the left. sorry if it sounds confusing. appeciate all help thanks andy I am trying to copy a pdf, and it is imperitive that the pages match up: page 1 on the pdf is page 1 on the html file when printed and so on. I am using font 12pt sizes. if it prints out correctly on my computer will it print out correctly on all since I am using the pt instead of something relative like <font size=3>? if this will not work for all then does anyone have any recomendations on how to do it? i have a base page that i use for a multi-page site, but i'd like to be able to insert more and more content, and have the page size accordingly. i think the problem is that the content is technically floating...or something, it's a cold fusion search result in a cart. i don't know, i might be asking for a miracle here- if you have an idea, let me know. Hi, Here's the site I'm working with: http://www.cjfusion.com I want to get that image centered on the browser window and then depending on how big the viewers screen is, the browser will cover up the left and the right. I hope that makes sense. I almost want it to be fluid, but I'm unsure how to do that. Ask questions if this doesnt make sense. Its hard to explain. -CJ I have a problem with this site - shop dot meenola dot com (Sorry - i am a new member and therefore cannot post a proper URL) - In FF the page is always scrollable to the right although there is nothing there and as far as i can tell the HTML ends in the initially viewable area. Not usually a problem for most - but using a macbook scrollpad, you tend to fly "offscreen" rather easily. Have tested in Chrome, IE, Opera and Safari - all of which display correctly (The page ends when the HTML does). Any ideas? Thanks /Adam Hello: I am building a website for a broad audience. I need there to be an option for text to be resized for those who have trouble with reading screens. I am trying to have the text on HTML pages be changeable through CSS. Two examples I offer are (URL address blocked: See forum rules) and (URL address blocked: See forum rules) On the top right corner of the screen, there are options to change the text size without switching to a new HTML page. I believe this is done using CSS (perhaps Live StyleSheet Selector). I'm not really sure. If anyone can help me, I would really appreciate it. Thanks! Deanna |