CSS - Why Do My Divs Overflow?
To my understanding, divs were block level elements, thus it should act like there is an auto <br> at the bottom of a div... but i am having an issue with my data flowing together... you can see it here...
Overflowing Divs (Link) my CSS layout is... Code: <div class="pic-container"> <div class="main-container"> <div class="titleinfo"></div> <div class="infocontainer"></div> <div class="reviewpics"></div> </div> <div class="menu"></div> <div class="clear"></div> </div> the problem i sthat the "reviewpics" div is meshing with the "infocontainer" div... here is bits of the CSS.. Code: div.pic-container { margin: auto; margin-top: 10px; margin-bottom: 10px; background-image: url(../pic/bg30.jpg); background-repeat:repeat; width:760px; display:block; border:2px solid #000000; } .titleinfo { text-align:center; } .infocontainer { margin:20px 0px 0px 115px; } .menu { margin:20px 0px 0px 100px; position: } .clear { clear:both; display:block; height:1px; overflow:hidden; margin:0; padding:0; } .maincontainer { min-height:590px; } * html .maincontainer { height:590px; } form { height:10px; } .titleinfo { text-align:center; } Similar TutorialsHi, I think this might requiere an IE hack buti have nested divs inside a div on http://gohedonist.com/mempage.php?id=19 but for some reason instead of the divs bein constainted inide the larger div they go all the way down the screen. This is works fine in FF. The problem is located at http://gohedonist.com/mempage.php?id=19 (select Submissions from the dropdown box on the right). Thanks for any help in advance. I had a problem earlier with my containing DIV pushing too wide which was resolved by adding "overflow:hidden" to my containing DIV. The problem is now that it's cutting off the sides of one of my graphics. At the bottom of my page, I have a link which you can click that will (through the magic of javascript) reveal divs on either side of my main content (the link at the bottom of the page says "reveal sea creature") When overflow:hidden was NOT on my containing DIV, I had the problem with all the extra space, but these revealing divs worked fine. Now that I add overflow:hidden, the extra space is gone, but the divs are cut off. I've tried pushing everything to the left which seems to make the DIV on the right work fine, but the left is still a problem. I realize this doesn't make sense without code, so here's the site. www . deepwaterchurch . com Thanks so much. Hi, I have faced a strange issue with the CSS overflow property while using nested DIVs.The DIV with class main has the DIV main-1a as its child which in turn has the DIV with class main-1a-child as its child. As the height of main is not fixed, so it is supposed to increase with main-1a and main-1a-child. But in Mozila FireFox, the height of main is not getting increased with the child DIVs. When the overflow property is set to hidden in main, then only the height of main gets increased with its childs. The issue is fine in IE6 regardless of the overflow property. Any help/explanation in this regard will be very helpful. <html> <head> <title>My Page</title> <style type="text/css"> .main { position:relative; width:800px; display:block; border:1px solid #000000; margin:auto; padding:10px 10px 10px 10px; background:#BABB99; height:100%; overflow:hidden; } .main-1a { width:780px; float:left; background:#FFFFFF; border:1px solid #FF0000; padding:10px 10px 10px 10px; } .main-1a-child { width:760px; float:left; border:1px solid #000000; padding:10px 10px 10px 10px; background:#BABB99; } </style> </head> <body> <div class="main"> <div class="main-1a"> <div class="main-1a-child"> <p>text of div1 a2</p> <p>snkjkjsd</p> <p>snkjkjsd</p> <p>snkjkjsd</p> </div> </div> </div> </body> </html> My CSS works in IE and Mozilla but not Netscape or Opera I have a 2 column website, built with 2 relative position DIVs, with overflow set to auto. Because of this, I turned off overflow on the body tag and on the html tag (overflow: hidden;). I didn't want to have 2 scroll bars on the right side of the window. When I first tested this on 4 browsers, IE, Mozilla, Netscape and Opera, it worked great, only having one scroll bar on the right side of the window when the page was longer than the window height. But when I moved to a new host server recently, I discovered that Netscape and Opera stopped working. They now simply give me blank screens. When I remove the "overflow: hidden;" specifications from the body tag and the HTML tag in my CSS file, Netscape and Opera once again display my web pages. However, now I get 2 scrollbars on the right side of all 4 browsers (in IE, the second scrollbar isn't actually there, but the space holder for the scrollbar is there). Is there a cross browser way for doing what I'm trying to do? Or am I faced with detecting the browser type on the server-side, and setting the style sheet appropriately? Here are the related parts of my CSS: /* CSS styles */ BODY { font-family : Verdana, Arial, Helvetica, sans-serif ; font-size : 10pt; background : Black; color : White; margin: 0; padding: 0; border-width: 0; overflow: hidden; } HTML { overflow: hidden; } #LeftNavDIV { position:relative; width:185px; height:100%; float:left; padding:2px 0px 0px 0px; margin:0px 0px 0px 0px; border:1px solid white; overflow:auto; } #ContentDIV { position:relative; height:100%; width:75%; float:right; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; border:0px dashed #336699; overflow:auto; } Ok, so I've learned to stay away from tables when you don't need them, and I have an instance where this is the case. I have a container div that has a header, content and a footer. On my home page, I have to divs next to each other with the same height and a div below them towards the right. To simplify my problem, look at this example. Code: <html> <body> <div style="float:right"> Hello there! </div> <hr> </body> </html> If there's a "float:right" on that div, the hr tag below doesn't get pushed down. But if I use relative positioning and don't use the floats, I can't put the two top divs next to each other. The other option is to use absolute positioning, but again content below doesn't get pushed down correctly. It seems that using "clear:both" works, but it seems weird that this has to be done. For example if I have floating divs in a container, I can get them to stretch out the container like so: Code: <html> <body> <div style="border: 1px solid #000; "> <div style="float:right"> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> </div> <div style="clear: both"></div> </div> <hr> </body> </html> Am I missing something fundamental here? Is there a better solution? Thanks in advance. Centering DIVs inside other DIVs in Firefox? Can it be done in a straight forward way? Setting the inner DIVs float to none seemed to work for IE but not FF. Here's the site in Question: http://www.winchps.vic.edu.au It's a standard fixed width floated DIV columns with a wrapper. One thing it does have is a second DIV inside both columns to display the Gradient background over the top of the repeated background. It works perfect in Firefox & IE7 (with a tweak) but IE6 mkes the sidebar nested div drop below the original sidebar DIV click here for a screenshot for those lucky enough not to have IE6. Here's the CSS code for the basic layout: Code: body { font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; font-size: 12px; text-align: center; margin: 0px 0px 60px 0px; padding:0px; border: 0; line-height: 2; } #header { width: 802px; } #wrapper { width: 802px; margin:0px; padding: 0px; text-align: left; margin: 0 auto; background: url(images/bodybg.jpg) center repeat-y; } #content { padding: 0px; margin: 0px; } #maingrad { background: url(images/winchcontentgrad.jpg) top left repeat-x; padding: 10px; } #main { width: 589px; float: right; background: url(images/winchcontentbg.jpg) repeat; border-left: solid 1px #000; border-right: solid 1px #000; } #mainstop { width: 589px; float: right; background: url(images/winchcontentbg.jpg) repeat; border-left: solid 1px #000; border-right: solid 1px #000; border-bottom: solid 1px #000; font-size: 10px; } #sidebargrad { background: url(images/winchsidebargrad.jpg) top left repeat-x; padding: 10px 5px 0px 10px; } #sidebar { width: 200px; float: left; background: url(images/winchsidebg.jpg) repeat; line-height: 2; font-size: 14px; border-left: solid 1px #000; border-right: solid 1px #000; } I obviously need to put a conditional comment in there, same for what I did for the minor IE7 tweak, but I'm struggling to suss out what's causing it, I haven't found the specific issue on any of the regular sites (PIE etc). Anyone got any ideas? The Example I've read a bunch about how div's won't stretch to accomidate div's inside of them if they overrun the height/min-height set for the container div. How do I get around this? You can see the skeleton of the site above. It's fine unless you resize the window smaller than the content. While working on my site, I am testing it in Mozilla Firefox 1.0pr and IE 6. In my code: body, td, iframe, table, div, tr { font-variant: small-caps; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #ffffff; background-color: #666666; scrollbar-3dlight-color: #666666; scrollbar-arrow-color: #666666; scrollbar-base-color: #666666; scrollbar-darkshadow-color: #666666; scrollbar-face-color: #666666; scrollbar-highlight-color: #666666; scrollbar-shadow-color: #666666; } a:link { color: #ffffff; text-decoration: none; } a:visited { text-decoration: none; color: #ffffff; } a:hover { text-decoration: none; color: #ff0000; } a:active { text-decoration: none; color: #ffffff; } select, option, textarea, input { border: #ffffff 1px solid; font-size: 11px; font-variation: normal; font-family: Verdana; background-color: #666666; } I would add "overflow: auto;" right under 'body, td, iframe, table, div, tr {' so that in Mozilla the scrollbars would not show up. However, when I load it in IE, the windows do not scroll at all. Is there a quick-fix for this, or what can I do so it will work properly in both browsers? My page looks decent in Firefox but in IE the overflow property doesn't seem to be working. Perhaps you can give me some pointers as to which tags may be messing up the display in Internet Explorer. The link to the page in question. http://www.paulvincentgandolfi.com/blog/?page_id=123 Thanks Hi all, I'm working on the site http://boolarongpress.com.au and have hit a problem. In IE7 if you click into either the title or author search fields in the left hand nav menu the cpu usage maxes out and IE7 hangs. There is no javascript attached to these inputs. The problem seems to be caused by a line in the css, overflow: auto; This is set for the content div so that it scrolls as if it were a frame. If I remove this line from the css the problem dissappears but of course the content div no longer scrolls. Has anyone got any ideas on how I can fix/work around this issue? Cheers, Peter How do I make the DIV overflow in the below codes? It works in IE but not firefox. <html > <head> <style type="text/css"> html, body { height : 100%; } </style> </head> <body> <table style="height : 100%; width : 100%"> <tr style="height : 64px; background-color : Blue;"> <td></td> </tr> <tr style="height : auto; background-color : red;"> <td> <!-- THIS IS THE PROBLEM --> <div style="height :auto; overflow-y : scroll"> <!-- THIS IS THE PROBLEM --> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> asd<br /> </div> </td> </tr> <tr style="height : 64px; background-color : Blue;"> <td></td> </tr> </table> </body> </html> what i'm trying to accomplish is two boxes next to each other inside a div, which i can scroll horizontally to see the two boxes. if you copy the code below it works correctly, only because the width of the parent div is set. Code: <style type="text/css"> #container { overflow:scroll; width:100px; } #parent { overflow:hidden; width:400px; } .box1 { border:1px solid black; float: left; height: 101px; width: 101px; } </style> <div id='container'> <div id='parent'> <div class='box1'></div> <div class='box1'></div> </div> </div> if i change width:900px in the parent div to width:auto then the boxes go underneath one another. That's the problem, the parent div should auto adjust to the width of both boxes. i'd really appreciate solving this. i can't have a fixed width on the parent div it should auto adjust and both boxes should be next to each other. this is the code i'm having problems with: Code: <style type="text/css"> body { font: normal 10px Verdana, Arial, Helvetica, sans-serif; color:#666; margin : 0; padding : 0; } /* text */ h1 { font: bold 10px Verdana, Arial, Helvetica, sans-serif; line-height:30px; } /* div classes */ div.row { position:relative; left:10px; width:326px; height:20px; z-index:1; margin-bottom:8px; text-align:right; } div.cell_title, div.cell_content { position:absolute; top:0px; float:left; padding:0px 0px 0px 8px; border:1px solid #E4E4E4; text-align:left; line-height:17px; } div.cell_title { background-color: #E4E4E4; left:0px; width:100px; z-index:2; } div.cell_content { background-color:#FCFCFC; left:100px; width:224px; z-index:3; } /* form elements */ .input { font: normal 10px Verdana, Arial, Helvetica, sans-serif; color:#666; background-color: #FCFCFC; height:15px; width:213px; border:0; } .textarea { font: normal 10px Verdana, Arial, Helvetica, sans-serif; color:#666; background-color: #FCFCFC; height:100px; width:213px; border:0; overflow:auto; } </style> <h1>Contact</h1> <form action="?menu=contact" method="post" name="contact"> <div class="row"> <div class="cell_title"><label for="name">name:</label></div> <div class="cell_content"><input type="text" class="input" name="name" id="name"/></div> </div> <div class="row"> <div class="cell_title"><label for="email">email:</label></div> <div class="cell_content"><input type="text" class="input" name="email" id="email" /></div> </div> <div class="row"> <div class="cell_title"><label for="message">message:</label></div> <div class="cell_content"><textarea class="textarea" name="message" id="message"></textarea></div> </div> <div class="row"> <input type="image" src="includes/images/btn_add.gif" name="Submit" value="Submit"> </div> </form> My problem is that my "row" div's overlay if their content is larger. Because of that i cannot see the send button from my form (the textarea height is bigger that the height of the "row" div - i need the layer to expland according to the content, but i don't want it to overlay on what is after it!). I hope that you understood my problem and could help my with it. Thanks in advance! hi, I have 3 DIV's, The first div is like a menu header DIV and the second DIV is the menu links and the third DIV has some information I want to click on the first DIV then show the second DIV like a menu problem is the third DIV moves down.. How can i let the second DIV overflow over the third DIV without it moving down? Thanks i always seem to have problems keeping inner elements within the confines of the div box. i always use overflow: auto, but i am wondering if i am going about this the wrong away. another annoying thing is using overflow: auto tends to make the div tab-able. Code: <div class="info_box"> <img src="images/temp_tiger.png" class="imgalignleft" alt="Petition Title" /> <h5>Petition Title</h5> </div> ... .info_box { clear: both; overflow: auto; border: 1px solid #999; background-color: #fff; margin-bottom: 8px; padding: 10px; font-size: 11px; } .info_box h5 { color: #06c; font-size: 14px; } Can anyone give me a lead as to where to start fixing the job IE6 is displaying my website? It looks ok in IEmac, safari, firefox, opera and netscape. My style sheet validates, and the xhtml for the page is valid with exception of the php counter within the div on the side, yet I took that out and tested and the same results occurred in IE6. Any help is greatly appreciated. url = bluewebpages.com EDIT: side menu, with addition of 'height:15px' to the #side ul li a, should display fine when i upload the changed css file, but the posts still display out of whack... Hey everyone, I'm making a photo gallery for a client. What I need is the overflow-x to be hidden, and overflow-y to be visible, but even when i set overflow-y to be visible, it appears with a scrollbar. My code is below... 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> <style type="text/css"> #galleryContainer{ position:absolute; height:140px; background-image:url(/images/galleryBack.png); background-repeat:no-repeat; width: 536px; } #galleryShow{ position:absolute; width:478px; height:113px; margin-left:28px; margin-top:14px; overflow:hidden; } #galleryView{ position:absolute; width:10000px; } .galThumb{ float:left; height:113px; width: 152px; z-index:60; text-align:center; } #leftArrow{ position:absolute; top:52px; left:7px; } #rightArrow{ position:absolute; top:53px; left:506px; } .galleryArrow{ width:23px; height:37px; z-index:40; } </style> <script src="/js/scriptaculous-js-1.8.3/lib/prototype.js" type="text/javascript"></script> <script src="/js/scriptaculous-js-1.8.3/src/scriptaculous.js" type="text/javascript"></script> <script language="javascript"> galleryLocation = 2; function slideGallery(gallMove,gallIncrement){ new Effect.Scale('thumbImg' + galleryLocation, 70); new Effect.Scale('galleryThumb' + galleryLocation, 94); galleryLocation = galleryLocation + gallIncrement; /*adjust center*/ new Effect.Move('galleryView', { x: gallMove, y: 0}); new Effect.Move('galleryThumb' + galleryLocation, { x: 0, y: -20}); new Effect.Scale('thumbImg' + galleryLocation, 150); new Effect.Scale('galleryThumb' + galleryLocation, 114); } function adjustCenter(){ new Effect.Scale('galleryThumb2', 114); new Effect.Scale('thumbImg2', 150); } </script> </head> <body onload="adjustCenter()"> <div id="galleryContainer"> <div id="leftArrow" class="galleryArrow" onclick="slideGallery(163,-1)"></div> <div id="galleryShow"> <div id="galleryView"> <?php for($i=1;$i<=14;$i++){ echo " <div id='galleryThumb" . $i ."' class='galThumb'> <img src='/images/cupcakeThumbs/galleryThumbs/" . $i . ".JPG' id='thumbImg" . $i . "'/> </div> "; } ?> </div> </div> <div id="rightArrow" class="galleryArrow" onclick="slideGallery(-163,1);"></div> </div> </body> </html> Thoughts? |