CSS - 100% Width Problem. I'm Stumped!
I have a container, header,left-side vertical navbar, content, and a footer. Everything works fine except when the content div is very wide. When this happens the header and footer are only as wide as the screen and not as wide as the content div. Here's my CSS.
Code: #container { width:100%; background: #fffce0 url(images/narrowtrick.gif) repeat-y;/*this colour will be left column colour */ margin:0px; padding:0px; text-align:left; } #header { height:145px; width:100%; background-image: url(images/topbackground2.jpg); text-align:center; margin:0px; padding:0px;} #navbar{ float:left; width:122px; margin:0px; padding:0px;} #content { background:#fffce0;/* background colour of right column */ margin-left:122px;/*this is the space for the left column */ padding:0px; } #footer { clear: both; border-top:1px solid red; border-bottom:1px solid red; background-image: url(images/gradientsmaller2.gif); font: 10pt; background-color: #ccffcc; width: 100%; text-align: right; margin:0px; padding:0px; } I can't figure this one out! Code: <div id=container> <div id=header> </div> <div id=navbar> </div> <div id=content> </div> <div id=footer> </div> </div> the content div is dynamic so it could be very wide. Similar TutorialsI have a problem that I cannot seem to resolve no matter how hard I try. - Click Here - As you can see, this page renders well in firefox but breaks horribly in IE. Try mousing over the links in the top right corner of the page and the layout really breaks! If anyone has some free time could you take a look at this page and see if any solution springs to mind? CSS: Code: body{ margin:0; font-size:small; text-align:center; background-color:#c60; border-top:3px solid #666; font:Arial, Helvetica, sans-serif; background-image:url(../images/background.png); background-attachment:fixed; background-position:bottom left; background-repeat:repeat-x; #content{ margin:2% 0% 2% 17.2%; background-color:#9cf; border:solid #0af; border-width:2px 1px; background-image:url(../images/bits.gif); background-position:top right; background-repeat:repeat-y; } #content h2{ color:#000; background-color:#fdb; border:1px solid #c60; padding:2px; width:100px; margin:5px auto -12px auto; font-weight:bold; font-size:12px; text-align:center; position:relative; } #table_wrapper{margin:5px;} #main_table{ background-color:#fff; border:1px solid #999; border-width:2px 1px; text-align:center; margin:0 auto; width:100% } #main_table thead tr th{ height:20px; } #main_table tbody tr td { font-family:"lucida grande", verdana, sans-serif; font-size:8pt; padding:3px 8px; border-right:1px solid #d9d9d9; } #main_table tbody tr.selected td { background-color:#fdb; border-left: 1px solid #d9d9d9; } #wrapper{ border-style:solid; border-color:#666; border-width:5px 1px; width:94%; margin:25px auto 50px auto; text-align:left; padding:1%; background-color:#fff; } #header{ height:60px; padding-top:8px; border-bottom:3px solid #0af; background-image:url(../images/banner.gif); background-position:bottom left; background-repeat:no-repeat; } #nav{ height:60px; float:right; font-size:11px; background-image:url(../images/notebook.gif); background-position:right; background-repeat:no-repeat; } #nav ul, #nav li{ display:inline; margin:0 25px 0 0; } #nav a{color:#000} #nav a:visited{color:#666;} #nav a:hover{color:#c60; border-bottom:1px dashed #c60;} #leftcol{ float:left; width:16.5%; margin:2% 0; border:solid #0af; border-width:2px 1px; background-color:#9cf; background-image:url(../images/bits.gif); background-position:top right; background-repeat:repeat-y; } #leftcol h2{ color:#000; background-color:#fdb; border:1px solid #c60; width:50%; margin:5px auto 0 auto; font-weight:bold; font-size:12px; text-align:center; padding:2px; width:30px; margin:5px auto -12px auto; position:relative; } #info{ border:solid #999; border-width:2px 1px; background-color:#fff; margin:5px; padding:0; } #info p{margin:10px 5px 5px 5px;} #footer{ color:#999; clear:both; width:100%; font-size:11px; text-align:center; border-top:3px solid #0af; } I've got a list item with a link, an image, and a span of text and I am trying to boost the text up in that box so that it is reasonably close to vertically centered. Code: <li><a href="productpage.php" class="bigimgcap"> <img src="../images/products30.gif" alt="Software logo" /> <span>Product Name</span></a> <ul> <li>Product Feature 1 </li> <li>Product Feature 2</li> </ul> </li> my css wasn't helping, probably have inherited properties issues all over this one eh? Code: .bigimgcap { font-size:1.1em; font-weight:bold; color: #000080; /*replaced SteelBlue*/ margin: 10px 0; padding:0; } .bigimgcap span { padding:0; margin: 0 0 15px 15px; } Hello everyone, I have a fairly basic CSS question to ask, but since I'm new to CSS, I'm a bit stumped. If you check out my Blog (at http://goblinsatemyblog.com), on the sidebar you'll see that the menu hovers are colored green. However, on a few of the widgets displayed, rolling over the menu truncates the link down a few pixels, which doesn't look that great. I applied "display: block" tags and a background color to the widgets to create the rollover, but some still work properly and others don't. What do I need to do to keep the rollover links from acting up? Here's the code pertaining to the two CSS files in the theme. Code: .custom li.widget li a:hover, .custom li.linkcat li a:hover { display: block; padding: 0 0 0 0.3em; color: #fff; background: #009933; } Code: #rss { width: 20em; height: 190px; margin: 0 0 1.0em 0; background: url('images/rss.png') 50% 0 no-repeat; text-align: center; } #rss a { display: block; width: 202px; height: 184px; margin: 0 auto; } ul.sidebar_list { list-style: none; } ul.sidebar_list li.widget, ul.sidebar_list li.linkcat { width: 16.6667em; margin: 0 0 2.8em 0; font-size: 1.2em; line-height: 1.6667em; float: left; border-bottom: 2px solid #009933; } li.widget p { margin: 0 0 1.66667em 0; } li.widget ul, li.linkcat ul { list-style: none; margin: 0 0 0.8333em 0; } li.widget li, li.linkcat li { padding: 0 1.0em 0 1.16667em; background: url('images/bullet.gif') 0 0.4167em no-repeat; } li.widget li a:hover, li.linkcat li a:hover { color: #575757; } I picked out the part of the CSS files that I think are relevant, but I can past the entire code if requested. Thank you in advance! It's my fault for not checking IE after every change but somehow a div stopped stretching and I can't find the problem. Works great in FF but not in IE 6 or 7. Here's the problem page It just doesn't make sense to me. Am I missing a hack maybe? I'm trying to create a (I think) simple page for an art gallery's artists. You can visit artizansc.com/dev/artists/artists.htm. I have created classes in my css for the artists' pictures (biopic), names (H2) and bio (biotext). I have also created a class called biowrapper to wrap each person's info. As you can see, the pictures are not lining up. It seems this should be simple and frankly, I'm feeling stupid. I'm new with CSS, but this shouldn't be rocket science! Can anyone please help me? http://www.turboconceptsllc.com/main.php in IE 6. how do i get the top banner stretch to span across the entire width of the browser? i think its stopping at the scroll bar, from what ive read.. how is this fixed? Code: .main_table_top_banner { background-image:url(''); background-repeat: no-repeat; background-color: #3A3A3E; width: 100%; height: 50px; position:absolute; left:0px; top:0px; overflow: none; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; border:0px solid; z-index:1; } I'm having a problem with a width attribute in IE7. The main content div on the page http://www.mckr.ie/test.html looks fine in Opera but in IE7 it makes the page scroll horizontally. Basically I didn't put a width on the #contentdiv styled <div>, its supposed to just occupy the width of the page automatically. When I put width 100% on it it messed up in IE6. Now I'm looking at it in IE7 and its similarly messed up. Does anyone know a way of solving this? Any help would be much appreciated. Here's my HTML code: Code: <div id="bannerdiv"></div> <div id="contentdiv"> Content here</div> <div id="leftnavdiv"><div id="leftnavouterdiv"><div id="leftnavinnerdiv">Nav here</div></div> <div id="searchdiv"><div id="innersearchdiv"><p><b>Site Web en Francais</b></p> <form action="http://search.atomz.com/search/" method="get" target="main"> <b>Search the Site<br /> </b> <input name="sp-q" size="15" /> <input name="submit" type="submit" value="Go" /> <input name="sp-a" type="hidden" value="sp10023119" /> <input name="sp-f" type="hidden" value="ISO-8859-1" /> </form> </div> </div> </div> <div id="topnavdiv"> <ul> <li><a href="/" id="buttonhome"><b>Home</b></a></li> <li><a href="about.html" id="buttonabout"><b>About Us</b></a></li> <li><a href="location.html" id="buttonlocation"><b>Location</b></a></li> <li><a href="contact.html" id="buttoncontact"><b>Contact Us</b></a></li> <li><a href="news.html" id="buttonnews"><b>News</b></a></li> <li><a href="people.html" id="buttonpeople"><b>People</b></a></li> <li><a href="recruitment.html" id="buttonrecruitment"><b>Recruitment</b></a></li> </ul> </div> Here is the relevant CSS code: Code: #bannerdiv { background-image: url(images/logo_banner.gif); height: 120px; width: 100%; background-color: #3366CC; background-repeat: no-repeat; background-position: left top; display: block; top: 0px; position: absolute; z-index: 9; left: 0px; } body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; margin: 0px; padding: 0px; } #leftnavdiv { position:absolute; left:0px; top:146px; width:237px; z-index:2; font-size: 11px; } #contentdiv { position:absolute; left:250px; top:146px; z-index:1 } #leftnavinnerdiv { width: 210px; margin-top: 0px; margin-bottom: 0px; margin-left: 10px; padding-bottom: 30px; padding-top: 0px; } #leftnavouterdiv { background-color: #EEF3F9; background-image: url(images/bg.newsbottom.jpg); background-repeat: no-repeat; background-position: right bottom; } #searchdiv { background-color: #EEF3F9; width: 234px; margin-top: 15px; margin-bottom: 15px; } #innersearchdiv { margin: 0px 15px; padding-top: 15px; padding-bottom: 15px; } #topnavdiv { position:absolute; left:0px; top:120px; width:100%; z-index:3; background-color: #3366CC; border-top-width: 1px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-top-color: #f8c015; border-bottom-color: #f8c015; border-right-color: #f8c015; border-left-color: #f8c015; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; height: 24px; } How do I make "content" <div class="content"> to go all the way to the right side of the "profile"? Code: <style type="text/css"> #container { width: 800px; background-color:#666; padding: 20px; } #profiles_container { background-color:#33CC66; } #profiles_container .profile { background-color:#CCFFFF; margin: 20px 0px 20px 0px; padding: 10px; } #profiles_container .profile .foto { background-color:#CCCC33; float: left; width: 200px; padding: 10px; } #profiles_container .profile .content { background-color:#FF0000; float: left; margin-left: 10px; padding: 10px 10px 10px 10px; } #profiles_container .profile .content .col1 { background-color:#CCFFCC; float: left; } #profiles_container .profile .content .col2 { float: left; } #profiles_container .profile .btm{ background-color:#999999; } .clear {clear:both;} </style> </head><body> <div id="container"> <div id="profiles_container"> <div class="profile"> <div class="foto"><img src="http://www.google.com/intl/en_ALL/images/logo.gif" alt="Photo_1" border="0" align="top" /> </div><!-- END foto --> <div class="content"> <div class="col1"><p>COLUMN_1</p></div><!-- END col1 --> <div class="col2"><p>COLUMN_2</p></div><!-- END col2 --> </div><!-- END content --> <div class="clear"></div> <div class="btm"><p>BOTTOM</p></div> </div><!-- END profile --> </div><!-- END profiles_container --> </div><!-- END container --> http://www.veracon.net/qwaffle/ If you look closely in Firefox, the content holder (left and right) is one pixel too small - it's meant to be the same size as the header. I don't see why this is happening, as it looks fine in IE. I could use some help. Hi all - ive discovered a css problem when using 100% width areas on a website. take the following site for example.. offmymakeupbox.com if you open a browser that is not maximized there is a scrollbar that allows you to scroll to the right, but if you scroll to the right you can see that the footer has been cut off. ie. it is the width of the resized browser and not 100% width of the actual template. is there a way to fix this? thanks hi, wonder if someone can help me. I'm trying to create a css layout for a site, which has a header then two vertical columns (pretty standard). i want the first column to be a set size and the second content column to be variable to use up the rest of the page space. i can get the first column and header to work fine but not the second content column. any help would be good. here my code: Code: #header { margin: 20px 20px 0px 20px; padding: 10px; border: 1px solid #666; background: #ccc; height: 100px; /* ie5win fudge begins */ voice-family: "\"}\""; voice-family:inherit; height: 70px; } html>body #header { height: 70px; /* ie5win fudge ends */ } #menu_v { position: absolute; top: 120px; left: 0px; margin: 20px; padding: 10px; border: 1px solid #666; background: #ccc; width: 150px; /* ie5win fudge begins */ voice-family: "\"}\""; voice-family:inherit; width: 120px; } html>body #menu_v { width: 120px; /* ie5win fudge ends */ } #content { position: absolute; top: 120px; right: 0px; /* Opera5.02 will show a space at right when there is no scroll bar */ margin: 20px 20px 20px 190px; padding: 10px; border: 1px solid #666; background: #ccc; } When i view rockitdesign.co.uk/portfolio in IE6, one of the columns seems too wide so the right one is getting squeezed underneath. This seems to happen on many of the sites i do so must be the same thing causing it? Any ideas? Thanks. me again, i fixed my last problem just to run into another i messed a little with my code, so that i have 2 elements on the page 'fixed' (in FF and IE) and the main body part is scrollable. the complete site is here i cannot seem to set a minimum width for the browser window. try to resize the window and you will see, that the main bodywindow will maintain at least 500px width in Firefox (not in IE < thats prob no.1) -- but also does the main body window slip underneath the navigation to the left. i tried to change the z-value, but even if i give them both the same z-value it slips underneath it. it would be great, if someone could help me with this problem, i know i have to correct it somewhere in the css, but cannot find it EDIT solved problem.... okay, so i just positioned (absolute) the bodybox element a fix amount away from the left border of the screen -- before it was 10% away from the right border of the screen .... it doesn't seem that liquid anymore, but i can live with it .... now i just need to convince IE to maintain a minimum width .... which topic has been discussed before EDIT2 i added the line Code: width: expression(document.body.clientWidth < 781 ? "780px" : "100%" ); to my fixed4ie.css file .... this messes on my old IBM ('95) around a little and i am not sure if you can see the graphic delay on newer computers. this is the only thing that worked for me so far .... interesting enough there are no more scrollbars, once i go under that certain width .... if - by now - someone has an idea how to fix this, i would appreciate other solutions to this problem Hi All, I have CSS-sheet= .thumbs { border: 2px solid #524b2f; position: static; height: 80px; width: auto; } body { background-color: #f5f0ec; font-family: Verdana, Arial, Helvetica, sans-serif; scrollbar-face-color : #f5f0ec; scrollbar-highlight-color : #aca899; scrollbar-3dlight-color : #f5f0ec; scrollbar-shadow-color : #aca899; scrollbar-darkshadow-color :#f5f0ec; scrollbar-track-color : #f5f0ec; scrollbar-arrow-color : #524b2f; } The thumbs part resizes some pictures to a fixed height of =80px and calculates the width so everyting is resized correctly. But IE6 gives problems with the width=auto , some times it's sets the widt correctly other times it doesn't. In other brouwsers its fine. Any suggestions on fixing this in IE6? here's the page link : http://www.sleuyter.be/04/lay04-1.htm thx, ROY http://www.ourdayton.com/index.html?do=regUser reffering to the dark blue box with the form contained in it: With the width set to default, or width:auto, it stretches to fit the parent. If I specify a width, the box will not stretch to hold the content within it. I've also played with min-width/max-width to no avail. I'm sure im just missing/forgetting a property. Here is the code for the box: Code: #generalBox{ width: auto; margin-left: auto; margin-right: auto; padding: 8px 8px 8px 8px; border: 1px solid #525c69; background-color: #212a34; text-align: center; } As simple as the problem sounds, Im completely puzzled by what could be going wrong. The problem is if I set the width of my div too 100%, it wont show up in Firefox. It works fine if I define it in pixels, but I want it to just stretch. Using a % works fine in IE. Here is the code: Code: #left { width:100%; height:598px; padding:0; background: #EEF; display: table-cell; background: url("bg.gif") top left repeat-x; } Anyone have any ideas? Hey guys, I'm new to the forums and would appreciate any help... I've never used fieldsets before, until now, and check out: http://www.koofers.com/contact.php A horizontal bar shows up in IE... and the globe in the top right of the screen goes off the monitor! And in FireFox, if I add bullet points to the content, the text actually goes outside of the fieldset. I know now the more I read that fieldsets are pretty much just for forms and such, but I really like the cool effect they give! And yes, I know... I shouldn't be using tables for my design, I should be doing crazy sweet things in CSS, but I'm still learning and don't have the time to totally re-design it in CSS (even if I could get it working!) Any help would be appreciated. Hi, I have the following css: Code: #container { background: url(../images/page.gif) repeat-y center; position:relative; width:100%; height:100%; } #banner {background:url(../images/banner.gif) no-repeat center; height:108px; width:100%; position:relative; } #menu {background:url(../images/menu.gif) no-repeat top center; height:124px; width:100%; position:relative; } #content { margin-left: 240px; font-family:'Helv', Arial, Helvetica, Geneva, sans-serif; font-size:14px; letter-spacing:1px; color:#000; text-align:justify; width:580px; position:relative; } #footer {background:url(../images/pgfooter.gif) bottom center no-repeat; height:46px; width:100%; position:relative; } all background are fixed width for 1024x768 and i have the following html <div id="container"> <div id="banner"></div> <div id="menu"></div> <div id="content"> All text goes here </div> <div id="footer"></div> </div> now the problem is that if i set the #container width to let say 1000px; it works fine (only resizeing the browser instantly ihave the horizontal scroller). So i want to set thethe container width to 100%. As soon as i set that and resize the browser the page flows well But the text in the #content div remains static and doesn't move along with the bkgrounds, thus flowing "out" of the text area. the links is here Code: http://ocdmonline.org/michael/ username: ocdmonline pass:4yGx3fM Any ideas? 10x |