CSS - Having Issues Getting Divs To Stretch Content And/or Container Divs
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. Similar TutorialsThe 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. Hi, what I'm trying to do is get two divs next to each other. That much I can do if I give them both a style of 'float:left;', but the problem with that is that they will overflow out of the div that they both sit in. Is there anyway to get two divs to sit next to each other, but to also expand the parent div if necessary? Thanks! Here's the template I'm working on: http://dhost.info/justusvizslas/template.php Here's my problem: I'm trying to create a centered, two-column layout with a header and a footer, sort of like the tutorial he http://nemesis1.f2o.org/aarchive?id=7 I've got everything working correctly and it looks fine in IE. However, in FireFox, the container div doesn't automatically adjust its height to be the same as the height of the divs inside. Instead, I have to set the height at a certain number of pixils to even get the container div to show up. When I do that, in IE the container div defaults to the same height as the larger of the two inner divs, but in FireFox the container div just stays at whatever pixil height I specified. That becomes problematic because I don't plan on having all my pagecontent divs with the same height. Any insight will be greatly appreciated. I've been looking at this for hours and haven't gotten it to work like it should. Here's the relevant code too: CSS Code: #container { width:792px; height:50px; margin: auto auto; color:#000000; background-color:#FFFFFF; background-image:url(design/menuimage.gif); background-repeat:repeat-y; } #navigation { width:125px; height:auto; padding:0px; float:left; margin-top:auto; vertical-align:top } #pagecontent { width:667px; height:auto; padding:0px; float:left; margin-top:auto; color:#000000; background-color:#FFFFFF; text-align:center } PHP Code: <div id="container"> <div id="navigation"><?php include "nav.php"; ?></div> <div id="pagecontent"> <br />Some more content here<br /> </div> </div> Again, thank you in advance for any help with this. If you're stumped and think it should work as-is, go ahead and go to the actual template I'm working on (first http link in this post) and look at it in IE and in FireFox to note the difference. --links aren't working so if you have the patience to put the files defined for page and style sheet below after evaxu dot com this is a challenging problem!-- Hey Guys, I've recently got back into web design by making my girlfriend a professional homepage in dreamweaver and css. So far so good, and pretty simple, however I've been trying to format the CV page but now it's starting to unravel... Basically, each element has had a div box put around it so that these can be arranged and floated to the positions I want. This seems to have worked in theory, however the bottom div (or 2 as they're columns next to each other) overlap the container and remove the whole container's background. I have put this online on /resumecssfail.html and you can use the navigation to see how the container background is supposed to be working as on other pages. The /style.css style sheet can be found and the relevant id's are container, maincontent and those starting with cv at the bottom. All that has been changed for this page really are width, float and some padding. However I have tried to use attributes like clear, positioning, display and various re-sizing and float changing to the last elements - whilst also putting the whole CV in other css boxes etc etc. I have put the code through the WC3 CSS validator which says it's valid to css 2.1. I've trawled through blogs and forum posts but just can't seem to find a solution :\ One thing that does seem to help is removing the last div tag (or putting in another tag and putting a character after it - I'm thinking of using a white ".") but this wouldn't be valid css now would it?! I'm going to use these for now on the official site page, but please use the link above to see my error page that I'd like help with. Thanks! I am having a problem with a couple divs not rendering correctly. I'm building an online tournament bracket system, and I'd like the divs to be flush with each other, but in all browsers it's rendering incorrectly. css Code: Original - css Code <style type="text/css"> div { font-family: Arial, Verdana, "Times New Roman", sans-serif; font-style: normal; color: Black; } .gamecontainer { position: absolute; width: 120px; } .player { font-size: 12px; background-color: lightblue; width: 100%; text-indent: 0.5em; border: solid 1px; margin: 0px; padding: 0px; } .infoblock { border-right: solid 1px; font-size: 10px; width: 100%; text-indent: 0.5em; margin: 0px; padding: 0px; } </style>
html4 Code: Original - html4 Code <div id="W-R1-G1" class="gamecontainer" style="top: 10px; left: 1090px;"> <div id="W-R1-G1-P1" class="player">Player 1</div> <div id="W-R1-G1-I" class="infoblock" style="height: 20px;">W-R1-G1</div> <div id="W-R1-G1-P2" class="player">Player 2</div> </div> <div id="W-R1-G2" class="gamecontainer" style="top: 75px; left: 1090px;"> <div id="W-R1-G2-P3" class="player">Player 3</div> <div id="W-R1-G2-I" class="infoblock" style="height: 20px;">W-R1-G2</div> <div id="W-R1-G2-P4" class="player">Player 4</div> </div> <div id="W-R2-G1" class="gamecontainer" style="top: 30px; left: 1210px;"> <div id="W-R2-G1-P1" class="player">Player 1</div> <div id="W-R2-G1-I" class="infoblock" style="height: 45px;">W-R2-G1</div> <div id="W-R2-G1-P2" class="player">Player 2</div> </div> <div id="W-R1-G1" class="gamecontainer" style="top: 10px; left: 1090px;"> <div id="W-R1-G1-P1" class="player">Player 1</div> <div id="W-R1-G1-I" class="infoblock" style="height: 20px;">W-R1-G1</div> <div id="W-R1-G1-P2" class="player">Player 2</div> </div> <div id="W-R1-G2" class="gamecontainer" style="top: 75px; left: 1090px;"> <div id="W-R1-G2-P3" class="player">Player 3</div> <div id="W-R1-G2-I" class="infoblock" style="height: 20px;">W-R1-G2</div> <div id="W-R1-G2-P4" class="player">Player 4</div> </div> <div id="W-R2-G1" class="gamecontainer" style="top: 30px; left: 1210px;"> <div id="W-R2-G1-P1" class="player">Player 1</div> <div id="W-R2-G1-I" class="infoblock" style="height: 45px;">W-R2-G1</div> <div id="W-R2-G1-P2" class="player">Player 2</div> </div> I need to know what attributes to give to my container div in order for this to work correctly. I have a div and within it are many floating divs, each that contain an image thumbnail and caption. I do it this way so the images fit on the page dynamically and it works great. Unfortunately the container div does not wrap around the height of the images. This causes content that should appear below the images to show up behind them. How do I make the container div actually stretch around all the child divs? here is a code sample Code: <div style="border: 1px solid blue; width: 100%; display : inline;"> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0003.jpg" rel="lightbox[post182]" title=" size 84k"><img border="1" src="/images/media/thumbs/182_YachtClub_0003.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0004.jpg" rel="lightbox[post182]" title=" size 57k"><img border="1" src="/images/media/thumbs/182_YachtClub_0004.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0006.jpg" rel="lightbox[post182]" title=" size 57k"><img border="1" src="/images/media/thumbs/182_YachtClub_0006.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0007.jpg" rel="lightbox[post182]" title=" size 57k"><img border="1" src="/images/media/thumbs/182_YachtClub_0007.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0011.jpg" rel="lightbox[post182]" title=" size 48k"><img border="1" src="/images/media/thumbs/182_YachtClub_0011.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0012.jpg" rel="lightbox[post182]" title=" size 49k"><img border="1" src="/images/media/thumbs/182_YachtClub_0012.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0013.jpg" rel="lightbox[post182]" title=" size 62k"><img border="1" src="/images/media/thumbs/182_YachtClub_0013.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0015.jpg" rel="lightbox[post182]" title=" size 49k"><img border="1" src="/images/media/thumbs/182_YachtClub_0015.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0016.jpg" rel="lightbox[post182]" title=" size 68k"><img border="1" src="/images/media/thumbs/182_YachtClub_0016.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0019.jpg" rel="lightbox[post182]" title=" size 62k"><img border="1" src="/images/media/thumbs/182_YachtClub_0019.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0020.jpg" rel="lightbox[post182]" title=" size 41k"><img border="1" src="/images/media/thumbs/182_YachtClub_0020.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0021.jpg" rel="lightbox[post182]" title=" size 63k"><img border="1" src="/images/media/thumbs/182_YachtClub_0021.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0022.jpg" rel="lightbox[post182]" title=" size 36k"><img border="1" src="/images/media/thumbs/182_YachtClub_0022.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0026.jpg" rel="lightbox[post182]" title=" size 41k"><img border="1" src="/images/media/thumbs/182_YachtClub_0026.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0028.jpg" rel="lightbox[post182]" title=" size 50k"><img border="1" src="/images/media/thumbs/182_YachtClub_0028.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0030.jpg" rel="lightbox[post182]" title=" size 52k"><img border="1" src="/images/media/thumbs/182_YachtClub_0030.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0031.jpg" rel="lightbox[post182]" title=" size 54k"><img border="1" src="/images/media/thumbs/182_YachtClub_0031.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0032.jpg" rel="lightbox[post182]" title=" size 63k"><img border="1" src="/images/media/thumbs/182_YachtClub_0032.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0033.jpg" rel="lightbox[post182]" title=" size 55k"><img border="1" src="/images/media/thumbs/182_YachtClub_0033.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0034.jpg" rel="lightbox[post182]" title=" size 41k"><img border="1" src="/images/media/thumbs/182_YachtClub_0034.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0035.jpg" rel="lightbox[post182]" title=" size 51k"><img border="1" src="/images/media/thumbs/182_YachtClub_0035.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0037.jpg" rel="lightbox[post182]" title=" size 48k"><img border="1" src="/images/media/thumbs/182_YachtClub_0037.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0038.jpg" rel="lightbox[post182]" title=" size 61k"><img border="1" src="/images/media/thumbs/182_YachtClub_0038.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0039.jpg" rel="lightbox[post182]" title=" size 30k"><img border="1" src="/images/media/thumbs/182_YachtClub_0039.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0040.jpg" rel="lightbox[post182]" title=" size 57k"><img border="1" src="/images/media/thumbs/182_YachtClub_0040.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0041.jpg" rel="lightbox[post182]" title=" size 45k"><img border="1" src="/images/media/thumbs/182_YachtClub_0041.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0042.jpg" rel="lightbox[post182]" title=" size 55k"><img border="1" src="/images/media/thumbs/182_YachtClub_0042.jpg" alt="" /></a><br/></div> <div style="float: left; margin: 2px; height: 150px;"><a href="/images/media/182_YachtClub_0044.jpg" rel="lightbox[post182]" title=" size 49k"><img border="1" src="/images/media/thumbs/182_YachtClub_0044.jpg" alt="" /></a><br/></div> </div> I cannot figure this out. I've tried adding clear: both in several places, I've tried overflow: hidden and I've tried cursing. Nothing works! How can this be fixed so that in IE6 the divs are not staggered vertically?? Code: <div style="height: 38px; margin: 0px; padding: 0px; width: 140px;"> <div style="float: left; height: 38px; width: 38px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="38" border="0"></div> <div style="float: right; height: 38px; width: 102px;">copy</a><br>copy</a></div> </div> <div style="height: 38px; margin: 0px; padding: 0px; width: 140px;"> <div style="float: left; height: 38px; width: 38px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="19" border="0"></div> <div style="float: right; height: 38px; width: 102px;"><img style="border: 1px solid #444444; vertical-align: middle" src="http://www.diversifieddesigns.com/GRAPHICS/Spacer.gif" alt="" width="38" height="8" border="0"></div> </div> Hi folks, I hope this is achieveable ... I have tried numerous ways of floating and whatnot, here is what i want: I want to have one container, having 3 divs inside. of these 3 divs the left and the right one are fluid, the center one is an image with a fixed width. looking like this: Code: ________________________ l l l fluid fix fluid l ________________________ restrictions: i do not want to use positioning at all. best would be, if it is all achieved with float and margins, looking good in IE and FF .... i have a page up, that will show you my design .... note, that only the box containing the image is the problem part on that page (some of you will recognize this i believe) the names of the classes are textboxleft, textboxright and id big_logo thanx! i want to redesign the page i have to only be displayed with floats and margins and no more positioning .... Hello folks. I am normally pretty handy with the CSS. I develop my sites in the latest of Firefox then test in IE 6.0. My latest site looks like gargabe in IE 6. Looks 99.99% perfect in Firefox. Here are the two problems: 1) I can't get the sliced image on the right lined up in IE 6 for the life of me! 2) On the front page, I have 2 tables underneath a paragraph. I don't like tables but for displaying 37 small icons... you get the idea. Anyway when you first go to the home page in IE the tables look okay. But if you navigate away then back, the icons go crazy! Please help! http://www.TattooSeek.info Newbie warning! I'm new to this forum, and new to CSS and having some trouble with formatting. I was very happy with a menu/submenu system that I am working on, as it displayed as I wanted in IE6. I know that different browsers handle things differently, so I tried it in Opera, and to my suprise.. not what I expected. There seem to be some issues with whitespace between my menus. I have 3 sections that should sit one on top of the other, but whitespace appears between each div. I did read through the posts first, but did not find an answer, though I'm sure its there! I have outlined the problem on this page: http://personal.nbnet.nb.ca/dsnyder The link includes snippets of my CSS and HTML, images of the correct and incorrect results, and a demonstration page. I do have some other questions in regards to highlighting the selected item on the submenu and how create the submenus in one include file if possible. Please take a look .. I'd be very happy to get an answer! Look forward to reading your responses, and the rest of the threads! hey all just new to layouts with CSS and having a few problems i managed to get divs to go side by side (not sure if it the best way to do it). now my content area divs are going crazy the bottom one appears on top and cuts into the navigation etc. Here is the HTML : 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>:: Reflective Web Design ::</title> <link href="rwd_style.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body onload="MM_preloadImages('images/b_home_over.jpg','images/b_news_over.jpg','images/b_bio_over.jpg','images/b_resume_over.jpg','images/b_portfolio_over.jpg','images/b_gallery_over.jpg','images/b_links_over.jpg','images/b_contact_over.jpg')"> <!-- Center Container --> <div id="center"> <!-- Banner Container --> <div id="ban_container"> <!-- Banner --> <div id="ban_left" style=float:left;clear:right><img src="images/banner_left.jpg" width="326" height="178" /></div> <div id="ban_right" style=float:left><img src="images/banner_right_top.jpg" width="650" height="87" /><img src="images/banner_right_middle_.jpg" /><img src="images/banner_right_base_.jpg" /></div> </div> <!-- Navigation --> <div id="nav" style=float:left;clear:right><img src="images/nav_side.jpg" width="24" height="279" align="left" /> <a href="home.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/b_home_over.jpg',1)"> <img src="images/b_home.jpg" alt="return to the home page" name="home" width="155" height="34" border="0" id="home" /></a><a href="news.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('news','','images/b_news_over.jpg',1)"> <img src="images/b_news.jpg" alt="view the latest news" name="news" width="155" height="35" border="0" id="news" /></a><a href="bio.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('bio','','images/b_bio_over.jpg',1)"> <img src="images/b_bio.jpg" alt="get to know me" name="bio" width="155" height="35" border="0" id="bio" /></a><a href="resume.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('resume','','images/b_resume_over.jpg',1)"> <img src="images/b_resume.jpg" alt="check out my resume" name="resume" width="155" height="35" border="0" id="resume" /></a><a href="portfolio.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('portfolio','','images/b_portfolio_over.jpg',1)"> <img src="images/b_portfolio.jpg" alt="view my web design portfolio" name="portfolio" width="155" height="35" border="0" id="portfolio" /></a> <a href="gallery.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('gallery','','images/b_gallery_over.jpg',1)"><img src="images/b_gallery.jpg" alt="view my other graphical works" name="gallery" width="155" height="35" border="0" id="gallery" /> </a><a href="links.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','images/b_links_over.jpg',1)"> <img src="images/b_links.jpg" alt="check out some useful links" name="links" width="155" height="35" border="0" id="links" /></a><a href="contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','images/b_contact_over.jpg',1)"> <img src="images/b_contact.jpg" alt="contact me " name="contact" width="155" height="35" border="0" id="contact" /></a> <img src="images/nav_base.jpg" align="left" /> </div> <!-- Content Container --> <div id="content_container"> <!-- Content --> <div id="content_top"><img src="images/content_top.jpg" /></div> <div id="content_left" style=float:left;clear:right></div> <div id="content_area" style=float:left> <!-- Content goes here --> AAA<br /> AAA<br /> AAA<br /> AAA<br /> AAA<br /> AAA<br /> AAA<br /> AAA<br /> AAA</div> <div id="content_right"></div> <div id="content_base"></div> </div> </div> </body> </html> and the CSS: Code: body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF; margin: 0px; padding: 0px; text-align:center; /* for IE */ background-color: #2A2A2A; } h1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 24px; font-weight: bold; color: #FFFFFF; } .heading2 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 18px; color: #CCCCCC; } .heading3 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight:bold; color: #CCCCCC; } .small { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: #CCCCCC; } a:link { font-size: 11px; color: #FFFFFF; } a:hover { font-size: 11px; color: #66FFFF; } a:visited { font-size: 11px; color: #CCCCCC; } .barref { background-image: url(images/barref.jpg); background-repeat: repeat-x; background-position: bottom; border: 1px solid #e8eaec; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF; background-color: #454545; } .barrefbox { background-image: url(images/barref.jpg); background-repeat: repeat-x; background-position: bottom; border: 1px solid #e8eaec; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF; background-color: #161616; } #ban_left { height: 178px; width: 326px; position: relative; } div#center { margin-left: auto; margin-right: auto; width: 976px; text-align: left; position: absolute; } div#ban_right { height: 178px; width: 650px; position: relative; } div#nav { position: relative; width: 179px; height: 279px; } div#ban_container { position: relative; width: 976px; height: 178px; } div#content_container { position: relative; width: 797px; } div#content_top { position: relative; height: 35px; width: 797px; } div#content_left { position: relative; height: 100%; width: 34px; background-image: url(images/content_left.jpg); background-repeat: repeat-y; } div#content_area { background-color: #171717; position: relative; height: 100%; width: 710px; } div#content_right { background-image: url(images/content_right.jpg); position: relative; height: 100%; width: 53px; } div#content_base { background-image: url(images/content_base.jpg); background-repeat: no-repeat; background-position: top; position: relative; height: 47px; width: 797px; } If anyone has any ideas how i can get this working or optimise it, it would be greatly appreciated This error happens with firefox but in IE7 the layout seems to stay together but the left side is force to the center of the screen .... Cheers Lance I hate to make this a forum post, as I am sure this issue comes up all the time. I've found a few blogs on this matter, but their fixes are not working for me. I am building a template @ http://curt.homelinux.com/campaign I have one main wrapper div called 'frame' that is supposed to wrap around all of the divs inside of it. All the while I had it set to a fixed height and just now realized that I need to attack this issue. Since the content will be dynamic, the 'frame' should be able to shrink and grow with the child divs. If any of you know how I can accomplish this, your help is greatly appreciated. The objective: Produce page content which behaves as if it were 'tabbed' as seen on many websites and programmes. I have done this many times before, but only with absolute positioning from the document base level. This time, the div containing the information to be tabbed has to appear relative (for re-sizability) and contain the tab divs within it. I am using a short javascript to change the z-index of the divs in order to produce the tab effect. The problem: The whole thing works fine, except for: - If I leave the css height off the divs, IE chops the bottom off, and does not allow a scroll. - If I put a height and auto (or scroll) overflow on the divs they display correctly in IE, but disappear in firefox - Until a table contained within one of the divs becomes larger than the stated height. At which point that div (not any of the others) disappears from IE as well. The question: Is this a known bug? If so, what is the work-around? Have I done something dumb? If so, what? The source: source files are available for download (they are quite large, and I don't want to trim them in case something in the trim is the problem. Plus they need to be large to demonstrate the length issue correctly). Text within these examples is copyrighted by various people and is used without permission, for illustrative purposes only. the xhtml page - click through the tabs to see the effect. Add extra rows to the table in the 'dates & prices' tab to see the disappearing problem. the javascript file - the function is at the bottom, 'layer_z_lift'. the css stylesheet - the styles for the tabs are in the middle, commented as tour details tabs. any questions, post and I shall answer. Jz. Good day! I have exhausted all of the people I could ask regarding this so I'm hoping I may get help here. This is the first website I've made and it's causing a lot of problems. http:// www . sycwin . com / index2 . html My issue is that my website is browser compatible with everything BUT IE. My problem is getting it to look the same on IE as it currently looks now on Firefox. I understand that there are java script solutions for div stacking problems, but for some reason those are causing no effects problems: 1. subinfo not positioning over mainwrapper and is instead STACKING on top of mainwrapper on IE 2. introduction not in position to the right of carousel/slideshow on IE 3. paints and wires divs are messed up in width, padding and margin on IE here's the css: Code: body { color:#333333; background-color: #f5f5ef; background-image:url(images/bg.jpg); background-repeat:repeat; font-family:Arial, Helvetica, sans-serif; line-height: 18px; font-size:11px; padding:0px; margin:0px; } emphasis { background-color:#e7d018; } strong { color:#2b6934; } a:active, a:link, a:hover, a:visited { border:none; text-decoration:none; } img { border:none; } /*MAIN SEGMENTS*/ #mainwrapper{ width:1000px; margin:0 auto; margin-top:-20px; margin-bottom:-50px; z-index:900; overflow:hidden; } #contentwrapper { width:1000px; margin-bottom:-10px; } #header { background-image:url(images/header.png); background-repeat:no-repeat; height:492px; margin-top:-15px; width:1000px; float:none; } #footer { width:1000px; height:222px; background-image:url(images/footer.png); background-repeat:no-repeat; background-position:bottom; margin-top:-300px; padding-top:-300px; margin:0 auto; } /*SUBINFO*/ #subinfo { width:220px; position:relative; top:0px; right:35px; float:right; z-index:1000; } #blurb { width:220px; height:165px; color:#FFFFFF; background-image:url(images/blurb_01.png); background-repeat:no-repeat; text-align:center; padding-top:380px; padding-bottom:64px; font-size:11px; } .call { font-size:22px; padding-top:20px; font-weight:bold; line-height:20px; } #contact { width:220px; background-image:url(images/blurb_02.png); background-repeat:no-repeat; font-size:14px; line-height:20px; text-align:center; padding-top:5px; } #blurb strong { color:#FFFFFF; } .blurbheader { font-size:20px; font-weight:bold; } .blurbsubtext { font-size:14px; font-weight:bold; } #credits { text-align: center; font-size:9px; line-height:14px; padding-top:80px; } /*CONTENT*/ #content { width:700px; background-image: url(content-bg.png); background-repeat:repeat-y; padding-right:250px; margin-top:-240px; padding-left:44px; } #slideshow { width:460px; padding-left:10px; height:360px; float:left; padding-bottom:20px; overflow:hidden; } #write-up { width:210px; height:360px; padding:8px 0 20px 10px; margin-left:470px; } #products { width:680px; padding-right:10px; margin: 0 auto; margin-top:20px; } #products td { width:160px; padding-bottom:5px; text-align:center; } #products-wires { width:660px; margin: 0 auto; margin-top:20px; } #products-wires td { width:220px; text-align:center; } .product-header { font-family:Gotham, Helvetica, Arial, sans-serif; text-align:left; font-size:25px; font-weight:bold; text-transform:uppercase; letter-spacing:-2px; line-height:14px; } #introduction { width:680px; font-size:11px; line-height: 18px; text-align:left; overflow:hidden; } #paints{ margin-right:18px; width:290px; padding:20px; background-image:url(images/introduction.png); background-repeat:no-repeat; height:195px; float:left; margin-bottom:20px; } #wires { margin-left: 348px; width:290px; padding:20px; margin-right:10px; background-image:url(images/introduction.png); background-repeat:no-repeat; height:195px; margin-bottom:20px; } .product-brand { background-color:#314842; color:#FFFFFF; font-family:Gotham, Helvetica, Arial, sans-serif; font-weight:bold; text-transform:uppercase; text-align:left; letter-spacing:2px; font-size:12px; padding-left:5px; } /*ROLLOVER*/ #preview{ position:absolute; border:1px solid #ccc; background:#333; padding:5px; display:none; color:#fff; text-align:center; z-index:3; } #preview img{ width:300px; height:300px; } /*CAROUSEL*/ #carousel ul { list-style: none; width:3600px; margin: 0; padding: 0; position:relative; padding-left:10px; height:350px; float:left; padding-bottom:20px; } #carousel li { display:inline; float:left; } #carousel { overflow:hidden; I hope you guys could help me figure this one out. I'm absolutely clueless. Thank you for taking the time to read this. Hey all, I have the following site: http://www.trshady.com All works fine but for SEO reasons along with my own desire to learn, I'm wanting to know how to change the code so that the layout stays the same, but the content of the page comes first in the code. So I have a 'topbar' div and a 'content' div. Without using absolute posistioning, how can I go about having the content div before the topbar div but still have it display the same as it currently does? Thanks for any help Hi, I'm racking my brain here and I can't figure out what I'm doing wrong. First of all, I have a "sidebar" div that is being pushed outside of the page, even though there is plenty of room for it in the content. http://65.175.116.253/design/demo.html I have included the CSS below, followed by the HTML and you can get the rar file for the entire layout at the following link http://65.175.116.253/design/design.rar I've been racking my head! All I want is the side bar, the two boxes way off to the right, to be floated to the right hand side of the screen, contained within the page. I can't figure out what I'm doing wrong. Can somebody look at this and tell me what I am doing wrong? I will paypal $5 to who ever figures it out.. Code: /*--- Generic Styles ---*/ body { background: #e3edc2; color: #333; font: .8em, Arial, verdana, sans-serif; margin: 0; padding:0px; } #main {width:840px; margin:18px auto 0 auto; _text-align:left;} a { color: #686397; } a img { border: 0px none; } p { margin: 0 0 1em; } .smallboldtext { font-family: verdana, helvetica, sans-serif; color: #686397; font-size: .7em; font-weight: bold; } .mediumtext { font-family: verdana, helvetica, sans-serif; color: #686397; font-size: .9em; } .mediumboldtext { font-family: verdana, helvetica, sans-serif; color: #686397; font-size: .9em; font-weight: bold; } .largetext { font-family: verdana, helvetica, sans-serif; color: #686397; font-size: 1.5em; } /*--- Header Styles ---*/ #header { margin-bottom: 1.75em; padding-top: 1px; background: #abd240; } #navbar { margin: 0; padding: 0.5em 3em; background: #686397; color: #fff; } #navbar li { display: inline; margin-right: 0.5em; padding-right: 0.75em; border-right: 1px solid #99c; font-weight: bold; } #navbar li.last { border: 0px none; } #navbar a { color: #d4ec84; text-decoration: none; } #today { text-align: right; margin-top: -1.66em; padding: 0 2em 0 0; color: #fff; line-height: 1; } /*--- Content Styles ---*/ #content { float: left; padding: 0 20em 4em 3em; width: 100%; } #content h1 { background: #fff; color: #686397; font-size: 1.5em; margin: 0 33% 1.25em -2em; padding: 0.4em 2em; } #content h1 b { color: #b0d742; } #content h2 { margin: 0.5em 0; padding-bottom: 0.25em; border-bottom: 1px solid #b0d742; font-size: 1.5em; } /*--- Content Styles ---*/ table.basic { border: 0px; width: 100%; border-collapse: collapse; } table.basicborder { border: 2px solid #b0d742; width: 505px; border-collapse: collapse; } table.mainsearch { border: 2px solid #b0d742; width: 415px; border-collapse: collapse; } /*--- Sidebar Styles ---*/ #sidebar { float: left; width: 17em; margin: 0 0 4em -18em; /* this creates a mathematical layout width of -1 */ } #sidebar div h3{ background: #9b96ca; } #sidebar form_div { margin: 0; padding: 0.8em; } #sidebar div{ background: #3a3c2d; color: #fff; padding: 0 1em 1em; margin-top: 0.75em; } #sidebar div h3{ font-size: 1.25em; margin: 0 -0.8em; padding: 0.4em 0.8em; text-transform: lowercase; } #whatiscompany h4{ margin: 0 0 0.5em; padding: 0.5em 0; border-bottom: 1px solid #fff; font-weight: normal; } #whatiscompany p:first-line{ font-style: italic; } /*--- Footer Styles ---*/ #footer { clear: both; padding: 1.5em 3em; background: #a0c63a; height: 15px; } #footer p { margin: .1em; } #footer a { color: #333; text-decoration: underline; } ------------------------------------------------------- Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>www.company.com/</title> <link href="css.css" type="text/css" rel="stylesheet" media="screen"> <!--[if IE]> <style type="text/css"> #today{ text-align: right; margin-top: 0; margin-bottom: 0; padding: 0 2em 0 0; position: relative; top: -1.66em; color: #fff; font-weight: bold; line-height: 1; } </style> <![endif]--> </head> <body> <!-- mockup, adding borders | markup, using float for layout (or the appropriate section) --> <div id="header"> <img src="logo.jpg" alt="a link to the home page" width="231" height="52"> <ul id="navbar"> <li class="first"> <a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li><a href="http://www.company.com">nav link</a></li> <li class="last"><a href="http://www.company.com">nav link</a></li> </ul> <p id="today">date here</p> </div> <!-- end div id header --> <div id="content"> <h1><b>home:</b> search</h1> <img src="flash.jpg"><br> <h2>quick search</h2> <table class="mainsearch"> <tr> <td> <FORM action="http://company.com/" method="post"> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> <input type="radio" name="quicksearch"><span class="smallboldtext">title</span> <br> </td> <td width="285" valign="top"> <br> <span class="smallboldtext">Keywords - </span><input type="Text" name="keywords" size="25"> <br> <span class="smallboldtext">Within - </span><select name="distance"> <option value="50" > 50 </option> <option value="Any" > Any </option> <option value="1" > 1 </option> <option value="5" > 5 </option> </select> <select name="distance_measure"> <option value="Miles" > Miles </option> <option value="kilometers" > Kilometers </option> </select> <span class="smallboldtext">of</span> <br> <span class="smallboldtext">City & State or Zip - </span> <input type="Text" name="zip" size="15"> <br> <center> <input type="submit" name="search" value="search"> </center> </FORM> </td> </tr> </table> </div> <!-- end div id content --> <div id="sidebar"> <div id="whatiscompany"> <h3>what is company.com?</h3> <h4>www.company.com</h4> <p> This is simply example text that goes here. Sample example text is in this place. You can read the sample text here it is. <br> </p> </div> <!-- end div id whatistea --> <div id="loginsidebar"> <h3>login</h3> <br> <form action="http://company.com" method="post" name="login"> <p> Username - <INPUT type="Text" name="member_user_name" size="12"> <br> Password - <INPUT type="password" name="member_password_a" size="12"> <INPUT type="submit" name="submit" value="login" > </FORM> <br> <a href="http://company.com">Forget Your Password?</a> <br> <br> </p> </div> <!-- end div id loginsidebar --> </div> <!-- end div id sidebar --> <div id="footer"> <p> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - <a href="http://company.com">nav link</a> - </p> </div> <!-- end div id footer --> </body> </html> I have a container div which includes a #header div, a left-floated #content div, a #right div, and a #footer div. The #content div has a background image that does not want to extend all the way down within the div to snuggly join the footer in any IE browser. I've tried the Holly hack, adding a line-height, relative positioning but to no avail. The stylesheet is embedded in the html file. Here's the link: http://www.emaycreations.net/BuildWebsiteIII/Week6/finalexamPractice.html It looks great in NN, FF and Opera but neither IE 5 nor 6 displays the page correctly. Can anyone help? Mari-Anne in Montana Hi everyone I have a 3 column layout with a footer. If the content ends up being too wide for the middle column (ie a large data table) I can't get the middle column to push the right hand column beyond the width of the screen. If the right column is absolutely positioned, the middle column just continues underneath the right column (overlaps). If the right column is floated right, it just drops down below the middle column. What I want it to do is bring up a horizontal scroll bar in the browser and let people scroll across for the right column. Based on the code below, if anyone has any ideas I would be unbelievably greatful. I've been pulling my hair out all day... My HTML is as follows: Code: <div id="content_container"> <div id="lft"> ... </div> <div id="mainbody"> .... </div> <div id="rght"> ... </div> <div id="footer"> ... </div> </div> My relevant CSS is as follows: Code: #content_container { position: relative; min-height: 100%; top: 0; left: 0; width: auto; height: auto; border: 1px solid red; } #lft { float: left; left: 0; top: 0; width: 24%; visibility: visible; } #mainbody { position: relative; left: 0; top: 0; width: 50%; height: auto; visibility: visible; } #rght { position: absolute; right: 0; top: 0; width: 22%; visibility: visible; padding-right: 10px; } #footer { float: left; bottom: 0; left: 0; top: 0; clear: both; width: 100%; margin-top: 40px; padding-top: 15px; padding-bottom: 15px; visibility: visible; } 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. |