CSS - Middle Div To Take 100% Height....
Ok guys, ive looked all over to try to find a code that will work, nothing so far.
So here it is css Code: Original - css Code * { margin: 0px; padding: 0px; } html { width: 100%; height: 100%; } body { height: auto !important; height: 100%; min-height: 100%; background-color: #efead0; margin: 0px; padding: 0px; position: relative; } .clear { clear: both; } /* Start Site - Container sets the width for the whole page Divs: - Top is the top image - Top li is for the menus - Content is for the actual site - Footer is for the bottom image */ #div_container { margin: 0px auto; width: 800px; height: 100%; } #div_top { background-image: url(images/body_top.png); background-repeat: no-repeat; width: 800px; height: 100px; } #div_banner { text-align: center; margin-left: auto; margin-right: auto; } #div_top li { position: absolute; top: 50px; list-style-type: none; } #div_content { background-image: url(images/body_main.png); background-repeat: repeat-y; width: 800px; } #div_footer { position: absolute; bottom: 0; background-image: url(images/body_bottom.png); background-repeat: no-repeat; width: 800px; height: 100px; }
and the html html Code: Original - html Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" URLWASBLOCKED> <html xmlns=URLWASBLOCKED> <head> <title>{L_TITLE}</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="site.css" /> </head> <body> <div id="div_container"> <div id="div_top"> </div> <div id="div_content"> <div id="div_banner"> <img src="images/banner3.png" width="755px" height="136px"> </div> </div> <div id="div_footer"> </div> </div> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" URLWASBLOCKED> <html xmlns=URLWASBLOCKED> <head> <title>{L_TITLE}</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="site.css" /> </head> <body> <div id="div_container"> <div id="div_top"> </div> <div id="div_content"> <div id="div_banner"> <img src="images/banner3.png" width="755px" height="136px"> </div> </div> <div id="div_footer"> </div> </div> </body> </html> What i am trying to do is have div_content take 100% of the page. having the top div stuck to the top, and the footer stuck to the bottom. I managed to do the bottom but i cant seem to make it so that the middle div takes 100% of the page. Im using Linux, so i am using firefox and chrome for testing but i also need it to be IE compatible. Help? Thanks. Similar TutorialsHi! Remind me please how to position something straight at the middle of display height? Hey, Here is an example of code for one of my links where I attempted to align the link "Entry Form" to the middle of the image, what am I doing wrong? Code: <p class="NavigationOption" id="Nav_Entry" line-height=32px text-align=middle><img src="../links/entryform.jpg" border=0></img> <a class="NavigationLink" id="NavLink_Entry" href="<?= ptpr; ?>members/index.php"><font color= #555555>Entry Form</a></p> I need a combination of this: http://bonrouge.com/3c-hf-fixed.php and this: http://bonrouge.com/3c-hf-fluid.php I need the middle column to be a fixed width and the outer two to be fluid. I also need to maintain the 100% with header and footer at top and bottom respectively. Any ideas how to do this? Thanks. 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 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 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. hi to all I have a round boxes using div, Inside this div there is an picture image which doesn't have a fix size fot both height and with. I want to put on the left and right side of another image such as left_anim.gif and right_anim.gif . But I want to center vertically this gif. If the picture image have a fix size I can center it vertically but it will varies depend on the size of the pictures, How can I achive this. any suggestions would greatly appreciated thanks in advance Tirso here is the sample link http://www.tirso.webberzsoft.com/mypicturecards_individual_others.php here is the code 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>CSS Example - How to create rounded corner boxes using CSS</title> <link type="text/css" rel="stylesheet" href="css/css.css" /> </head> <body> <div id="formdiv"> <div id="picturecards_individual"> <div class="top"><div class="bottom"><div class="left"><div class="right"><div class="bl"><div class="br"><div class="tl"><div class="tr"> <div id="buttons"> <div class="cont"> <div class="frame" id="frameimage"> <div style="float:left; vertical-align: middle"><img src="images/left_anim.gif" /></div><img src="picturecards/individual/DSCF0011.JPG"/></div> </div> </div> <div style="clear:both"></div> </div></div></div></div></div></div></div></div> <!--end of rounded box--> </div> </div> </body> </html> how can i get a div in the middle of the y-axis of the browser window? I have this code: Code: <html> <head> <style type="text/css"> body { font-family: arial, helvetica, serif; font-size: 100%; background: white; padding: 2em; margin: 0; } #content { width: 34em; background-color: #ffffff; padding: 1em 0; border: 6px double #6DA9CA; margin: auto; voice-family: "\"}\""; voice-family:inherit; width: 32em; } html>body #content { width: 32em; } a { text-decoration: none; } a:link { color: #080; } a:visited { color: #790; } a:active { color: red; } a:hover { text-decoration: underline; } ul { padding: 0; margin: 0; list-style: none; } li { float: left; position: relative; width: 10em; text-align: left; cursor: default; background-color: white; } li ul { display: none; position: absolute; top: 100%; left: 0; font-weight: normal; padding: 0.5em 0 1em 0; border: solid 1px #6DA9CA; } #submenu li ul { border: solid 1px #6DA9CA; } li>ul { top: auto; left: auto; } #nav a { color: black; } #nav a { text-decoration: none; } #nav li li a { display: block; font-weight: normal; color: #060; padding: 0.2em 10px; } #nav li li a:hover { padding: 0.2em 5px; border: 5px solid #6DA9CA; border-width: 0 5px; } li:hover ul, li.over ul{ display: block; } </style> <script type="text/javascript"> startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; </script> </head> <body> <ul id="nav"> <li><a href="">Home</a></li> <li><a href="">Guiding Principles</a></li> <li>Background & Qualifications</a> <ul> <li><a href="">Biography</a></li> <li><a href="">Dispute Resolution</a></li> </ul> </li> <li>Developments <ul> <li><a href="">International</a></li> <li><a href="">Specialty & Agrichemical News & Regulations</a></li> <li><a href="">Archive</a></li> </ul> </li> <li><a href="">Other Resources</a></li> </ul> </body> </html> And I like it - but I have one problem - I want there to be lines between each of the <li>s in the submenus - meaning between Biography and Dispute Resolution I want a line - I know there is no border-middle value - so how do I do this? demo: http://www.soundwebdev.com/hh/ As you will see, the middle column starts its background image too low. The left and right put it in the correct place, but the center is about 12px too low. All the styles are in the source. Any help is GREATLY appreciated! hi is there a way to get a div to be in the vertical middle of the screen. i tried : margin-top: auto; margin-bottom: auto; but it doesn't work. thanks 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 Thanks for taking the time to read my question. I have an image that I want to place in the middle of a contaier. I have <center></center> around the <img /> tag, but I can't get it to center vertically with the css below. What am I doing wrong? Thanks, Brad CSS: Code: img.contentimg { vertical-align: middle; } HTML: Code: <div class="textbox1"><center><img class="contentimg" src="images/house1.jpg" /></center></div> hello everyone, I've been reading this forum for ages, but I thought i'd finally post. I have a problem with my site forexpm.com The ads are supposed to be on the right hand side, but some people say that in firefox they are in the middle, covering the text. I know it's something to do with css, but I can't work out what it is. Can anyone please help? Thanks muchly. I have been looking for this all over the place but cant find the right solution. I want a div aligned like it's on this website. Code: http://www.captaincrawl.com/ 1. It's aligned in the center/middle of the screen 2. It's relative so it moves according to the window size 3. It should work on major browsers such as IE Can anyone help me please? Sorry folks, css novice here. But i'm trying to get this div into the center of my browser. It works vertically, but each time I try to sort it out horizontally it goes all over the place - any thoughts on this? Code: <html> <head> <title></title> <style> .greenBorder {border: 1px solid green;} .redBorder {border: 1px solid red;} </style> </head> <body> <div class="redBorder " style=" #position: absolute; _top: 50%;display: table-cell; vertical-align: middle; text-align:center;"> <div class="greenBorder" style=" #position: relative; #top: -50%; " > stuff </div> </div> </body> </html> what am I doing wrong? recommend any good css books? I've got an image that is 75px high. Right beside it, I have a H1. I want to vertically align the H1 in the middle of the image. Vertical align doesn't work, and for some reason, setting the line height to the height of the image doesn't work either. |