CSS - Forcing A Minimum Height For A Div
Hello all,
I'm trying to find a solution for the problem hereafter : I'm building a css2 based website where all thelayout is controlled in the CSS. I have in my website a main "body" box identifier by a CSS ID. This "body" is a container for various articles. It has a background and borders. I would like this "body" box to have a minimum heigth so that even if the content (ie the article) is made of two lines, the background and the borders have this minimum size. The problem is that if i use the "heigth" attribute in my CSS id, when the content is longer for that heigth, the box is not extended, only the text, going out of the box. To summarize, i'm looking how to fix a minimum height to a DIV or any block component of a css, without limitating this block to this only height. I hope i have beel clear, if any of you have an idea for this, it would be very helpfull to me, as this is a very recurrent problem. Thanks by advance Similar TutorialsI am having a problem trying to get one column match the height of another. Within a large DIV box, I created two columns separated by about 20 px. I floated one to the left, then pushed one over to the right. Both boxes will expand depending on the amount of content, but I would like them to match the same height. The boxes will be used throughout the entire website, so it would not make sense to create a background image to try and trick it into being the same height.. or actually specifying the height. Is there any way to tell the left box to be the same height as the right box?? I tried to link to my site but it won't let a new member link to a website. i was trying to position what should have been a square of 5px by 5px on the screen, but ended up with a rectangle with a width of 5px but a height of what looked like at least 10px ! all margins + paddings had been set to zero, so that wasn't the reason in the end i managed to draw a square by adding : Code: max-height: 5px; overflow: hidden; to the div's style it still puzzles me though : does a <div> element have a default minimum height ? Hello! I'm working on a website right now and have sort of dived in further than I understand conditional CSS. The website is he www.kekoz.com I have that little menu in the upper right and the info in the lower right. I like those being fixed so when the user scrolls they are always up there. But I can't figure out how to make them stop from colliding with the main pictures when you change the height of the page. Any help would be grand! Right now they're position super simple: Code: #links{ position:fixed; top: 20px; right:20px; width:300px; } Code: #info_box{ position:fixed; bottom: 25px; right:10px; width:550px; } I tried to set a minimum height on them, but I think that would have to do with some sort of a container around them. Or maybe I'm just going about it all wrong. Also a couple other things I'm sort of thinking. I would like the "Scroll this way" thing to always be centered between the lower edge of the pictures and the bottom of the window. Not %100 sure how to get that set up. And the last thing I'm thinking for this page, which I'm not sure is all CSS would be to have the "scroll this way" thing actually fade based on the scroll position. I think this might be Jquery but thought I'd throw it out there to see if anyone had any advice. I'm a newbie to css. I'm trying to convert tables to css and having a bit of a tough time. Latest problem - create a window or container with a one line border with minimum height, say 600px, but the height will expand as the content grows. Any help? Thank you kindly! I was experimenting this weekend with some CSS 'page-sculpting', using small divs to make shapes, etc. I used FireFox as my testbed and of course everything went smoothly. I switched over to IE6 and saw that every div had a minimum height-it looked like 1em. I specified height and width on all <div>. Some used borders, some did not. An example would be: PHP Code: <div style="height:2px; width:3px; background:green" ></div> Has anyone else come across this or know of a fix? I haven't tried <span> or other tags (I will...just thought of that), tho I suspect they'll behave the same. Any help appreciated. NotGoddess http://www.rocksolidhq.com/anmar/index.php I'm having trouble with getting the popout menu to display on top of the content. Does anyone have any idea how to force it to display on top of the content. I also want it to display under the flash animations but I'm sure that it will be forced to do that because of the way Flash works anyway. the stylesheet for this is http://www.rocksolidhq.com/anmar/styles/anmar.css Im currently working on converting my companys site to CSS2 and XHTML (www.fwawest.com) as the current one dose not comply to any standard I have managed so far to creat the top banner including down to "Construction News : UK News :" The problem Im having is the 3 colums under that. I have the 3 colums but when you resize the browser I dont want the 3rd colum to go behind the content. in other words I want the whole site to have a minimum width. becuase atm the 1st Colum (navAlpha) and the main contents (content) stay where they are which is not a problem and content has a minimum width of 300px but when you make the browser small anouth to hit the minimum width the 3rd colum (navBeta) gose behind the content. CSS Code: .content { position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */ width: auto; top:0px; min-width:120px; margin-left: 190px; margin-right: 190px; border:1px dashed black; background-color:white; padding:20px; z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */ } #navAlpha { position:absolute; width:200px; left:0px; top:138px; border:1px dashed black; background-color:#eee; z-index:2; padding:10px; /* The ugly brilliant hack. */ voice-family: "\"}\""; voice-family:inherit; width:168px; } /* "be nice to Opera 5". */ body>#navBeta {width:168px;} #navBeta { position:absolute; width:200px; top:138px; right:0px; border:1px dashed black; background-color:#eee; padding:10px; z-index:1; /* The ugly brilliant hack. */ voice-family: "\"}\""; voice-family:inherit; width:168px; } /* "be nice to Opera 5". */ body>#navBeta {width:168px;} HTML Code: <!-- Main Content --> <div id="navAlpha"> <p title="'left' DIV">example text</p> </div> <div id="navBeta"> <p title="'right' DIV">example text</p> </div> <div class="content"> <p title="'middle' DIV">example text</p> </div> P.S No I did not make the orginal site , and yes it uses tables Hi there, What i'm trying to do is get two tables to stay on the right side, to the top. i'm assuming i'll need to use a 'float' attribute to acheive this...only i've never used it before, and don't really know what to do. i've had a look at a couple of tutorials, but couldn't find exactly what i'm looking for. Code: <table width="25%" border="0" align="right" cellpadding="0" cellspacing="0" class="scrollboxalign"> <tr> <td width="4%"><img src="images/menu_logo.jpg" width="49" height="27" alt="Gamut Promotional"></td> <td width="90%" style="background-image:url(images/menu_spcr.jpg); height:27px;" valign="middle" class="titletext">Samples</td> <td width="6%"><img src="images/menu_close.jpg" width="3" height="27" alt="Gamut Promotional"></td> </tr> <tr> <td colspan="3"> <table width="94%" class="border" align="left" cellpadding="3" cellspacing="1"> <tr> <td class="boxtext"> <div id="scrollingtextbox"> <? echo $samples ; ?> </div> </td> </tr> </table> </td> </tr> <tr> <td align="center" height="10"> </td> </tr> <tr> <td width="4%"><img src="images/menu_logo.jpg" width="49" height="27" alt="Gamut Promotional"></td> <td width="90%" style="background-image:url(images/menu_spcr.jpg); height:27px;" valign="middle" class="titletext">Pricing</td> <td width="6%"><img src="images/menu_close.jpg" width="3" height="27" alt="Gamut Promotional"></td> </tr> <tr> <td colspan="3"> <table width="94%" class="border" align="left" cellpadding="3" cellspacing="1"> <tr> <td class="boxtext"> <div id="scrollingtextbox"> <? echo $pricing ; ?> </div> </td> </tr> </table> </td> </tr> </table> those are the tables i want forced to the top right. thanks for the help! i tried searching for this and wasn't able to find any threads. i have a container div with my content, and then i have a footer div that i want to always be at the bottom of the page. i've got it to work in FireFox, but IE is a pain as usual. can anyone look at this and tell me if i'm doing it right and/or what i'm doing wrong? thx. css Code: #container {min-height: 87%; width:620px; margin: 30px auto; position:relative; text-align: center; clear: both; background-image: url(images/backgroundCol.gif); background-repeat: repeat-y;} #container_footer { margin:auto; height:50px; width:620px; text-align:center; background:#FF0000; clear:both; position:relative; margin-top: -80px; clear: both; background-image: url(images/footerBackground.gif); background-repeat: repeat-y;} html Code: <div id="container"> container <br class="clearall" /> </div> <div id="container_footer"> this is the footer <br class="clearall" /> </div> here is the page in action so far http://www.photography139.com/index.html So I'm not sure how to search for what I'm trying to do so I figured I'd just ask. On my test website: http://www.temple-of-lore.com/siege911 I noticed on the front screen, the image that I have on the bottom doesn't go to the bottom of the page which breaks the effect I'm trying to do. You can see what I'm trying to do on other pages. Anyways, I know I'm going to be putting more content eventually on that front page, but I'm sure there will be someone out there with a huge Apple monitor with amazing resolution that's going to break my page. I'd prefer a way to just force the image to go to the bottom and fill any black above it if the screen is taller than the content on the screen. But on pages where it's not taller, I'd like it to be below the content and let it scroll down. Anybody know how to do this? never mind. can it be done? ideally in IE5-6 and Netscape6+ cheers 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! 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. 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> 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 My web page has a display bug in IE 5+ on Windows. Specifically, I have a DIV within which I wish to place two images. The two images are the same height and width, and I want to layer them (the top one is a PNG with transparency, but I have already solved that problem, this is a positioning problem) exactly on top of each other. I have done this by positioning them relatively within the DIV. The first image is top:0;left:0 and the second is top:-150;left:0 (the images are 150 px tall). They layer fine, but the DIV is twice the height (as if the second image were still following the first, making he DIV 300 px tall). I have tried many things and am stumped. Here is the site: URL Here is the relevant CSS: Code: #bannerPhoto { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000; height: 150px; width: 750px; } #bannerPic { position: relative; z-index: 1; left: 0px; top: 0px; } #bannerText { position: relative; z-index: 2; left: 0px; top: -150px; } And the HTML: Code: <div id="bannerPhoto"> <div id="bannerPic"><img src="../images/bannerPhotos/image.jpg" height="150" width="750" /></div> <div id="bannerText"><img src="../images/text-cover.png" height="150" width="750" /></div> </div> Anyone? Thanks, Denver. i came across a solution for this a while ago and can't repeat the result i have 3 columns, div format with a left left right float. 1 2 3 #2 contains content that varies with the page, #1 and #3 contain background elements. i need 1 and 3 to extend the full height of 2, even tho the actual content is much less. thanks for the help! |