CSS - Crossbrowser Width Problem
I am currently workin on a new design for my site and have decided to go tabless (the way it should be). I have gotten pretty much as far as I can apart from adding the content. I have been testing my design in both IE6 and FireFox 1.0.4. I have noticed some problems in width in both browsers.
Here is the link to my site: Panik Design's New Layout In IE6 the main div does not stretch out to 700px, It only lines up with the header div when i change the width to 704px. But when I do that , Firefox is then out of line because Firefox measured it correctly the first time. As for Firefox problem. FF is not measuring the module widths correctly. They are set to 150px and would like them to display like they do in IE6. I will now post my code: Code: <html> <head> <title>Panik Designs</title> <style type="text/css"> body { margin: 0px; background: #fff; color: #000; font-size: 10pt; font-family: verdana; } h1 { font-family: verdana; color: #000; font-weight: bold; font-size: 24pt; } #header { border-left: 2px solid #000; border-right: 2px solid #000; background: #FBF2D9; width: 700px; margin: 0; } #main { position: relative; width: 700px; border-left: 2px solid #000; border-right: 2px solid #000; height: 100%; background: #FBF2D9; } #leftcontent { position: absolute; padding-top: 10px; left: 0px; background: #FBF2D9; width: 150px; text-align: center; } #rightcontent { position: absolute; padding-top: 10px; right: 0px; background: #FBF2D9; width: 150px; } #centercontent { position: absolute; left: 150px; padding: 10px; background: #FBF2D9; width: 400px; text-align: left; } #moduletop { position: relative; width: 140px; padding: 5px; color: #fff; font-weight: bold; text-align: center; border: 1px solid #000; background: #26476C; } #modulebottom { position: relative; width: 140px; padding: 5px; color: #fff; font-weight: bold; text-align: left; font-size: 10pt; border: 1px solid #000; border-top: 0px; background: #4184B4; background-image: url("images/modulefill.jpg"); background-position: 0% 100%; background-repeat: repeat-x; } </style> </head> <body> <center> <div id="header"><img src='images/header.jpg'></div> <div id="main"> <div id="leftcontent"> <div id="moduletop">: Navigation :</div> <div id="modulebottom"> Item one<br> Item two<br> Item 3<br> </div> This is the left content </div> <div id="centercontent"><h1>Heello</h1><br>Thisis where the center content will go. blah blah blabh blah all of this is fun fun fun i like cheese.</div><div id="rightcontent"><div id="moduletop">: Statistics :</div>This is the right Content</div> </div> </body> </html> I have not added a doctype because it adds even more problems to the page. As shown on this page: Doctype problems: Doctype problems Similar Tutorialshi, can anybody tell me that how can i will make following css styles to be viewed same in both internet explorer and mozilla explorer(cross browser compatibility). here is my code thanks mrjameer <style type="text/css"> html, body { margin: 0px; padding: 0px; border: 0px;background: url(bg1.gif)repeat-x; background-color:#66CCFF; } #navcontainer ul { padding-left : 0; margin-left : 80px; margin-top:20px; background-color : #036; color : #FFFFFF; float : left; width : 73.2%; font: 100% tahoma;line-height: 1.7; } #navcontainer ul li { display : inline; } #navcontainer ul li a { padding : 0.2em 1em; background-color : #036; color : #ffffff; text-decoration : none; float : right; border-right : 1px solid #fff; } #navcontainer ul li a:hover { background-color : #369; color : #fff; } #header { margin-left : 80px; margin-top : 0; float:left; } #right { position : relative; height : 779px; width : 267px; float : right; margin-right:72.3px; background-color : #ffffff; margin-top : -8px; color:#000000; font: 100% tahoma; background-image: url(h2.jpg); background-repeat: repeat-x;} #left1 { position : absolute; /*right : 155px; */ margin-right:400px; margin-top : -8px; margin-left:160px; height : 230px; width : 564px; float : left; font: 100% tahoma; /*background-color : #FFFFFF; */ color:#23238e; background-image: url(a1.jpg); background-repeat: repeat-x;} #left2 { position : absolute; /*right : 155px; */ margin-right:400px; margin-top :221px; margin-left:160px; height : 296px; width : 564px; float : left; font: 100% tahoma; background-color : #e6e6e6; color:#000000; background-image: url(a2.jpg); background-repeat: repeat-x;} #about_imgtable { width:218px; margin-left:50px; margin-top:8px; position:relative; /*margin:auto;*/ /*border:1px dotted navy;*/ border-style:groove; padding:1px; border-color:#006400; clear:right; border-width:2px; color:#ffffff; background-image: url(hostingbg.jpg); background-repeat: repeat-x; } #about_img { float:left; padding:0 10px; margin-top:5px; } #about_right_text { display:table-cell; } #product_imgtable { width:220px; margin-left:300px; margin-top:-158px; position:relative; /*margin:auto;*/ /*border:1px dotted navy;*/ border-style:groove; padding:1px; border-width:2px; border-color:#006400; background-image: url(tutorialsbg.jpg); background-repeat: repeat-x; color:#ffffff; } #product_img { float:left; padding:0 10px; margin-top:5px; } #product_right_text { display:table-cell; } #community_imgtable { width:470px; margin-left:50px; margin-top:14px; position:relative; /*margin:auto;*/ /*border:1px dotted navy;*/ padding:1px; border-style:groove; clear:right; border-color:#006400; border-width:2px; background-image: url(toolsbg.jpg); background-repeat: repeat-x; color:#ffffff; } #community_img { float:left; padding:0 10px; margin-top:5px; } #community_right_text { display:table-cell; margin-top:10px; } #left3 { position : absolute; /*right : 155px; */ /*margin-right:500px;*/ margin-top :517px; margin-left:160px; height : 291px; width : 285px; float : left; font: 100% tahoma; background-color : #ffffff; color:#000000; background-image: url(a3.jpg); background-repeat: repeat-x; } #lo { width:260px; height:200px; margin-left:10px; margin-top:40px; position:relative; /*margin:auto;*/ /*border:1px dotted navy;*/ padding:1px; background-image: url(greens.gif); background-repeat: repeat-y; color:#ffffff; border-styleutset; border-color:#ff69b4; } #login { margin-left:100px; margin-top:30px; } #offline { margin-left:40px; margin-top:30px; } #left4 { position : absolute; /*right : 155px; */ /*margin-right:500px;*/ margin-top :517px; margin-left:445px; height : 291px; font: 100% tahoma; width : 279px; float : left; background-color : #ffffff; color:#000000; background-image: url(a4.jpg); background-repeat: repeat-x; } #shamroc_imgtable { width:260px; height:190px; margin-left:10px; margin-top:5px; position:relative; /*margin:auto;*/ /*border:1px dotted navy;*/ padding:1px; background-image: url(scriptsbg.jpg); background-repeat: repeat-x; color:#ffffff; border-styleutset; border-color:#FF69B4; } #shamroc_img { float:left; padding:0 20px; margin-top:5px; } #shamroc_right_text { display:table-cell; word-spacing:5px; } #blank_footer { width : 831px; clear : both; height : 150px; background-color : #6f636b; font: 100% tahoma; color : #000066; text-align : center; position : absolute; margin-left : 160px; background-image: url(a5.jpg); background-repeat: repeat-x; color:#ffffff; } #footer { width : 831px; clear : both; height : 150px; background-color :#ffffff; color : #000000; text-align : center; position : absolute; margin-left : 160px; margin-top:150px; font: 100% tahoma; background-image: url(g.jpg); background-repeat: repeat-x; } </style> I'm currently working on a rather challenging development (at least for me) and trying to resolve some CSS strangeness that I can't track down the root of. The basic design is working out... or was until I started checking for cross-browser compatibility. Currently: It looks good/works in Safari/Gekko and IE5Mac. The top of the page draws correctly in Firefox/Netscape/Mozilla, but the content areas are white rather than showing through to the Faux-columns below (I even tried setting redunant background: transparent on the divs to see if it was a parenting bug) Opera 7+ looks pretty much right, except it is adding a 15px margin to the top of the body of the page (before the viewport) that no other browser is adding. I haven't even seen it in IE5/6 Win, but I'm pretty sure it's screwed there. If anyone is particular familiar with one of these issues, I'd greatly appreciate it if you could point me in the right direction of an article or point out a chunk of my code that doesn't make sense or is causing the error. The template page is here. The CSS document can be seen here. Thanks in advance to anyone who has time to assist. -- Aiden Hi guys I've this code, it looks fine in IE (damn..) but it does not look in Firefox Code: body { scrollbar-track-color: #D8AFAF; scrollbar-face-color: #660000; scrollbar-highlight-color: #927373; scrollbar-3dlight-color: #663333; scrollbar-shadow-color: #660000; scrollbar-darkshadow-color: #660000; scrollbar-arrow-color: #FF0000; } What's wrong ? - my Firefox version (1.0.1) - the css code ? thanks 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. 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; } 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. 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 --> 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 - 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 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; } New guy on the scene - I need a little help. Seems basic, but I can't figure it out. html and body tags set to a width of 100%. I have a div that I want to be 100% with a border. If I set it to a width of 100% and a border of "1px solid #000" the div actually expands 2 pixels beyond the right edge of the page in FF. Haven't tried it in IE yet. In any case, anyone know how to solve this? If not, any creative work-arounds? Thanks. 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? ok here i am again with a width problem ,, http://www.bekirhoca.com/index.asp < here's the problematic page. the index looks fine but inner pages like http://www.bekirhoca.com/ogretmen/uzmanortmen.asp (this is one of the pages cleared from tables) , content width is smaller and not like as i want it to be or you want it to be ,, in my css when i gave width it looks fine on my computer but on another computers not because i adjust the width for my computer. when i give width, if you have a tight browser the content overflows and puts itself to the downwards of the page. And also when theres no width, the site sux in ff. where the the problem starts in my css #contentColumn { float: left; background:white; //if width: a number; } in ie the main page looks fine but the inner pages in for ex: http://www.bekirhoca.com/ogretmen/uzmanortmen.asp width sux. When i gave width value its not okay both in ie and firefox. So now I publish my site with spaces between columns in ie and messed up style in firefox. I think that'd help ,, i want a code that will keep my site remain same when the window has a small weight or height Please helppppppppp 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 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. |