CSS - Display Different Height Div As Same Height
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! Similar TutorialsHi 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. 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 Hi! Remind me please how to position something straight at the middle of display height? Hi guys, I am building a page with CSS and I'm running into some problems with the CSS buttons I'm trying to use. Right now I have a large box along the top of the page and want two rows of buttons inside of it. These text on these buttons will likely be changing on a semi-regular basis. So instead of using gif buttons made in a graphics program, I'm using CSS to create the buttons. Since each row will have multiple buttons, I first used the display:inline; item and it worked fine in IE. In FF however, the buttons lost their height and width. If I also used the float:left; it worked right, but the buttons were not centered. In looking for a solution, I discovered that inline items cannot use the height and width properties. Any ideas on how to get what I'm looking for? I can't post a link, because this is an intranet page, but here is my relevant code... CSS Code: Original - CSS Code /*the main box which will contain the buttons*/ div#Main-buttons { width:96%; margin:2%; margin-top:10px; height:100px; padding-top:10px; background-color:#84C394; border:ridge medium #004500; } /*adjustments for FireFox*/ html>body div#Main-buttons { width:90%; margin:5%; margin-top:10px; height:100px; padding-top:0px; background-color:#84C394; border:ridge medium #004500; } /*class for individual buttons*/ div#buttons { width:100px; height:30px; margin:3px; float:left; background-color:#F7F3B5; border-style:solid; border-width:2px; border-color:#ffffff; line-height:1.6; display:inline; } a.buttonLinks:link {color:#000000; text-decoration:none;} a.buttonLinks:active {color:#000000; text-decoration:none;} a.buttonLinks:visited {color:#000000; text-decoration:none;}
HTML Code: Original - HTML Code <div id="Main-buttons"> <a href="#" class="buttonLinks"><div id="buttons">Testing</div></a><a href="#" class="buttonLinks"><div id="buttons">Testing</div></a></div> <div id="Main-buttons"> <a href="#" class="buttonLinks"><div id="buttons">Testing</div></a><a href="#" class="buttonLinks"><div id="buttons">Testing</div></a></div> Thanks in advance guys! I am sure there is an obvious explanation but why does using display:inline in this class definition stop the height/width working? Remove it and the dimensions are preserved. PHP Code: DIV.special_offer_middle { width: 100px; height: 20px; display: inline; border: 1px dashed white; } I 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. 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. Hi Guys, Consider the following box: PHP Code: <div style=border: 1mm black Solid; width: 148mm; height: 98mm;'> </div> 148mm + 1mm + 1mm = width of 150mm 98mm + 1mm + 1mm = width of 100mm Now why does neither firefox or ie manage to get it? Firefox is about 2mm out and ie is about 3mm out? Any ideas or is it some quirk? Charlie Hi all, I'm in the middle of creating a web app and i'm trying to get 2 columns to fill the height of the screen, i can do this if i know the height of the top div (see diagram below), but i'd prefer to keep that flexible because the content's of it will change. i've tried using javascript to get the remaining height, but again this'll only work if i know the height of the top div (i'd get the column height by subtracting the top div height from the browser's screen height) ... plus i'd prefer not to rely on javascript to do this thought i'd ask if anyone else has been suffering from this problem and has managed to find a fix? thanks for any help If I try and set a div to 1px height then it just gives me a standard line height div. If I set it to 100px it goes that height (so I know the height command is working). Is the following code not possible? PHP Code: #strapline1 { position: relative; top: 10px; left: 0px; width: 760px; height: 1px; background-color: #74C2A8; background-image: url(/gfx/spacer.gif); } PHP Code: <div id="strapline1"></div> Hi, With the following layout: .formBlock { border-bottom: 1px solid #000000; } .formLeftSide { float: left; background: #E7E7E9; width: 140px; padding: 13px 5px 5px 10px; margin-right: 10px; font-family: arial black, sans-serif; font-size: 15px; } .formRightSide { padding: 10px; } PHP Code: <div class="formBlock"> <div class="formLeftSide">Selling Agent details </div> <div class="formRightSide"> <br><br><br><br><br><br><br><br><br><br><br> </div> </div> ... how would I get it so the "formLeftSide" div takes on the full height of the containing "formBlock" div? As it is now it just ends after the text, even tho the "formRightSide" div pushes the height of the "formBlock" div below it. I'm suffering with one of my new projects, in IE it is quit good but in FF on some screens smaller then 19" i have a problem with the 100% height... the website is visible on: http://dudzele.no-ip.info:8080/netdistri/ for thos who don't get the code by url: css: Code: /* commented backslash hack v2 \*/ html, body{height:100%;} /* end hack */ body { font-family: Verdana, Arial; font-size: 12px; background-image: url('images/bg4.gif'); background-repeat: repeat; background-color: #999999; margin: 0px; margin-top: 5px; margin-bottom: 5px; padding: 0px; height: 100%; min-height: 100%; font-family: verdana, sans-serif; text-align: center; } #afbeelding { text-align: center; } #pagebox { min-height: 100%; height: 100%; width: 760px; background-color: #FFFFFF; margin-left:auto; margin-right:auto; border: 1px solid #000000; } #pageheader { width: 760px; height: 106px; background-image: url('images/headnd.gif'); background-color: #465A73; font-size: 10px; text-align: left; border-bottom: 1px solid #000000; margin: 0px; vertical-align: middle; font-size: 16px; color: #FFFFFF; } .login { margin-top: 45px; margin-left: 20px; font-size: 10px; } input { font-size: 9px; width: 100px; height: 15px; background-color: #F0F0F0; border: 1px solid #000000; } p { display: table; margin-top: 5px; margin-right: 10px; } h1 { font-size: 16px; text-decoration: underline; text-align: left; color: #A91008; padding: 0px; margin: 0px; margin-top: 10px; margin-bottom: 5px; width: 155px; } h2 { margin: 5px; text-align: left; color: #3C86AB; } #content { text-align: left; margin-top: 5px; margin-left: 170px; } #posmenu { float: left; height: 100%; min-height: 100%; } ul#menu { list-style: none; width: 150px; margin: 0px; margin-left: 5px; padding: 0px; } ul#menu li { margin-top: 0px; } ul#menu li a { color: #000000; text-align: left; text-decoration: none; font-weight: bold; padding-left: 5px; font-size: 12px; display: block; height: 100%; width: 100%; } ul#menu li a:hover { text-decoration: underline; border-top: 0px; display: block; } .submenu { margin-left: 15px; border: 0px; } html: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="nl"> <head> <title>Netdistri Welkom</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="resource-type" content="document" /> <meta http-equiv="Window-target" content="_top" /> <meta name="robots" content="index, follow" /> <meta name="description" content="Netdistri your network distibution partner" /> <meta name="keywords" content="network, dedicated, colocation, interxion" /> <meta name="rating" content="general" /> <meta name="distribution" content="global" /> <meta name="revisit-after" content="7 days" /> <meta name="author" content="Dutchzone" /> <meta name="generator" content="Dev-PHP 2.0.12" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> <meta http-equiv="Content-Language" content="nl-be" /> <meta name="MSSmartTagsPreventParsing" content="TRUE" /> <link href="netdistri.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="pagebox"> <div id="pageheader"> <table class="login"> <tr><td>login</td><td><input type="text" name="login"></td></tr> <tr><td>password</td><td><input type="text" name="password"></td></tr> </table> </div> <div id="posmenu"> <ul id="menu"> <h1>General</h1> <li><a href="?page=about" class="menu">About us</a></li> <li><a href="?page=news" class="menu">News</a></li> <li><a href="?page=press" class="menu">Press</a></li> <li><a href="?page=jobs" class="menu">Jobs</a></li> <li><a href="?page=contact" class="menu">Contact us</a></li> <li><a href="?page=reseller" class="menu">Resellers</a></li> <li><a href="?page=partners" class="menu">Partner Links</a></li> </ul> <ul id="menu"> <h1>Products</h1> <li><a href="?page=hardware" class="menu">Hardware</a></li> <li><a href="?page=software" class="menu">Software</a></li> <li><a href="?page=services" class="menu">Services</a></li> </ul> </div><div id="content"> <h2>Your IT-Solutions!!</h2> <p> Netdistri is a belgian IT-company specialised in networksolutions.<br /> The company stands for quality and that results in many satisfied customers! </p> <h2>Why and what?</h2> <p> We have choosen to specialise us in network-applications and hardware because there is not one company in Europe who take care to know each product they sell. By us you get support for each product you ever bought at our company! So for little problems or not hardware related, we will help you to get a fast solution, so you see fast and accurate is our vision! </p> <h2>Become a partner!!</h2> <p> When you become a partner (reseller) with Netdistri you will be sure you get the latest information about new products, you will be sure we will test those for you and give us our opinion. Even when you are a manufacturer we can help you, by us you are sure your products will reach the right customers.</p> </div> <div id="afbeelding"><img src="images/handshake.jpg" border="0" align="center" alt="partnership" /></div> </div> The strange effect of an image that is in the contentbox or out the content box... Someone any solution? Thanks for taking the time to read my question. I have a main container width=800px and overflow=hidden. I have a background image for the main container width=800px, height=400px I don't have enough content to make the container have a height of 400px, but would really like it to be. Is there a way of having a min height of 400px while still having overflow=hidden? I tried putting in a height=400px, but that seems to cancel out the overflow=hidden. Thanks, Brad i tryed create a little spacer off 1px high but when iview what ive done the height looks around 20px? div#space {width:248px;height:1px;background-color:#f1d4f0;} please help :] Hi everyone. Does anyone have any ideas about this and this? If you make the text smaller (doesn't work in IE) OR have a screen resolution above 1024x768 you will notice that under the text the white doesn't continue but the blue does, any idea how to fix this? I have tried setting min-height: 100% (height in IE) that works, but then there is a scroll bar when not needed, the extra space appears to be the same amount of the header bar. NOTE: I am NOT using tables. Thanks for any help. JamesRP hi, i created a div and made height attribute to auto and then inside that div i created another 2 divs and changed their height to 100px. parent div is now changing it's height. but when i make the child div to float the parent div doesn't change its height. can some one give any solution for this.it'll be a great help.thank you. bellow is the code <html> <head> <style type="text/css"> .wrapper{ width:70%; height:auto; margin:0 auto; text-align: left; border:thin; border-color:black; border-style:dashed; } .image{ width:100%; text-align:center; } .image img{ width:65%; } .thumbs{ width:100%; height:auto; border:thin; border-color:black; border-style:dashed; } .thumbs div{ width:10%; text-align:center; border:thin; border-color:black; border-style:dashed; padding:1%; margin:1% 0 0 1%; float:left; //when i remove this it changes the height cursorointer; } .thumbs div img{ width:100%; } body{ text-align: center; } </style> </head> <body> <div class="wrapper"> <div class="image"> <img src="images/1.jpg" alt=""> </div> <div class="thumbs" id="thumbs"> <div> <img src="images/1.jpg" alt=""> </div> </div> </div> </body> </html> |