CSS - Different Margin Behaviour Firefox - Explorer
Hi,
I'm noticing a different behaviour between firefox and explorer regarding de margin attribute, and I can't explain it applying the well known box model difference. Here is the css code: Code: div#main { margin: 10px auto 20px auto; width: 1001px; border: 1px solid #000000; } div#left { float: left; width: 150px; } div#content { width: 600px; margin-left: 160px; background-color:#0033CC; } Here is the HTML: Code: <div id="main"> <div id="left">left</div> <div id="content">content</div> </div> What I get in firefox is the expected, the content div is exactly at 160px distance of the inner part of the main div border. However in explorer the distance is 163px?? According to the box model difference, if we consider that in explorer the width includes the border, the distance should be 161px but not 163px. Any ideas? Caste Similar TutorialsWhy Oh Why?? Internet Explorer.... *gripe gripe* I have this basic code... Code: #rightside { float:right; width:315px; } #rightside_top { height:6px; background:url(/images/rightbg_top.gif) no-repeat; } #rightside_bottom { height:800px; background:url(/images/rightbg_bottom.gif); } <div id="rightside"> <div id="rightside_top"></div> <div id="rightside_bottom"></div> </div> It looks great in anything that isn't IE... but IE adds about 10px under the first div (rightside_top), which breaks the image effect i am trying to accomplish anyone know how to efficiently get rid of this gap?? Hi All; I generated this page : www.lilahd.com/bevi In webgen and cannot view it correctly on IE . Please view the page in IE and then in Firefox . Why does that happen . Having a weird effect in firefox in that it doesn't seem to respect the right margin correctly. What I am trying to do is line up text so that it flushes to an image that is to the right, but for some reason it pushes the image off the page. (floatWrap is a clearing div so <br style="clear: both"> is not needed) Code: Code: <div class="floatWrap"> <div style="float: right;"> <img src='imageSrc'> </div> <div id="txtWrap" style="float; left;"> <div class="floatWrap"> <div style="float; right;"> Some text which should be right up on the picture and to the left of the title </div> <div style="float; left;"> Title which will never reach the text next to the picture </div> </div> <div> Text that will reach the picture but for some reason pushes it out of the way instead of wrapping to the next line. </div> </div> </div> #txtWrap is the div that wraps the entire contents to the left of the image. I want this to flush all the way up to the image but give a buffer of 5px. I tried setting #txtWrap {width: 100%; margin-right: 5px;} but it pushes the pic off the screen. I am assuming this b/c a scroll bar at the bottom of the browser appears I tried setting #txtWrap {margin-right: 5px;} but the text within keeps pushing farther to the right than it's supposed to, causing the whole wrap to push the to the next line. Where can I set the margin-right property so it displays correctly? Hi everyone! I'm pulling my hair out on this one. I must confess I'm a bit green when it comes to css, but I've been playing around with this page and was finally able to get it looking the way I want in IE. If you look at it in Firefox or Netscape, the container doesn't expand at the bottom, and the links just spill out. Any ideas on how I can get this to expand like it does in IE? http://www.gotop100.com/test.html Thanks! I've built a website using only div's and I am only having problems with one of them... I have the div with a margin-left : 48px; In IE this aligns the div with a section of text above it (the result I had wanted) however in Firefox it displays about 20pixels to the left of the IE display. If I set the margin-left : 96px; it aligns properly in Firefox but is then messed up in IE. I have an attachment of my code its not very large. Is there any fix for this problem? on this page the image on the left that reads "Grade" is 10px from the side (where it should be) in IE... but in firefox, it isnt 10px from the side... but rather 0px... when i change the margin-right to 20px instead of 10px, it looks fine in Firefox, but 10px too far over in IE. any help would be GREAT thanks Please look at itsjustmelive.com in both firefox and internet explorer. When you roll over the "service" button in Internet Explorer the entire page moves down. Not in firefox because I specified a height. How do I fix this in IE? Thanks! Bev Hi, First post on here! ...I have a problem with the default margin in IE being 1px less than Firefox. I've stripped my CSS down to be as naked as possible! It's quite frustrating as I'm quite experienced with CSS, I guess the small silly things do things like this when you've not been CSS'n for a few months! 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>Untitled Document</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> test </body> </html> CSS:- Code: * { margin: 0; padding: 0; } I have a menu that has no margins and I have a content box with has a margin-left of 79. Each menu item's length is 78 pixel, so I'd gradually guess that margin-left:78 would align the border of the menu item and the content box... Here's my problem. If I make it 78, it aligns in IE but not in Mozilla Firefox. When I make it 79, it aligns in Mozilla but not IE. Thanks in advance. Hello, I'm having a slight issue with what I belive to be margins. In IE half the logo is being cut off and in firefox I have a grey area above the menu bar that shouldn't be there. I have checked both my css and xhtml both validated fine with out any warnings. I'm pretty new to CSS and this is starting to annoy me =\. **WARNING** The site is political in nature. Links to the code: h**p://www [.] dncreform [.] com / t / css / main.css h**p://www [.] dncreform [.] com / t / Thank You, William http://www.djoj.net/home.html <- Faulty Page http://www.djoj.net/style.css <- CSS Hey, for some reason in Internet Explorer my Div will not center and I do not know why. I will try and prvide more detaily when I get home from school. Thank you, ~Brendan Sorry for the "general" title but I don't know what is causing my problems, so it is hard to be specific... I am working on a web application for my summer research project, but I am not very knowledgeable in CSS. For the most part I am able to solve my problems except for the following: Issue 1: Profile Display Issue 1 CSS file The copyright at the bottom. Firefox displays correctly. Explorer displays too much white space above the copyright text. Issue 2 *IMPORTANT*: Profile Display (with missing fields) Issue 2 CSS file The text in the SME Profile does not display correctly when some of the fields are left blank (Issue 1 link shows a full profile). I'm trying to avoid using tables as it would cause some major setbacks in my work. FYI, the pages are dynamically generated so links will not work. Any suggestions? I created a CSS box where there's a header image & a css box under it, having 3 sides (no top border). It looks good in firefox, but can't get the box to close all the way (by meeting the header image) in explorer. There's a 2-3 px space there. li'l help please? Hi, I'm studyng php for content management system. The php is ok. I used an external stylesheet, when i see it in Firefox is ok. But when i see it in Explorer it's not ok. The problem is on the left colum, the lists don't work well in Explorer. It seems to be difference between how Explorer and Firefox works with Stylesheets. If can anyone help to make this css code compatible for the two browsers. Here's the code of my css : /* Site Colors: #1A446C - blue grey #689DC1 - light blue #D4E6F4 - very light blue #EEE4B9 - light tan #8D0D19 - burgundy */ html { height: 100%; width: 100%; } body { width: 100%; height: 100%; margin: 0px; padding: 0px; border: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; background: #D4E6F4; font-size: 13px; line-height: 15px; } img { border: none; } table, tr, td { border-collapse: collapse; vertical-align: top; font-size: 13px; line-height: 15px;} a { color: #8D0D19;} #header { height: 70px; margin: 0px; padding: 0px; text-align: left; background: #1A446C; color: #D4E6F4; } #header h1 { padding: 1em; margin: 0px;} #main { margin: 0px; padding: 0px; height: 600px; width: 100%; background: #EEE4B9; } #structure { height: 600px; width: 100%; } #footer { height: 2em; margin: 0px; padding: 1em; text-align: center; background: #1A446C; color: #D4E6F4; } /* Navigation */ #navigation { width: 150px; padding: 1em 2em; color: #D4E6F4; background: #8D0D19; } #navigation a { color: #D4E6F4; text-decoration: none; } ul.subjects { padding-left: 0; list-style: none; } ul.pages { padding-left: 2em; list-style: square; } .selected { font-weight: bold; } /* Page Content */ #page { padding-left: 2em; vertical-align: top; background: #EEE4B9; } #page h2 { color: #8D0D19; margin-top: 1em;} #page h3 { color: #8D0D19; } Thanks for yout time. Hey y'all. I was hoping someone could help me with some minor margin/padding issues. At one point I knew how to fix this, but I can't for the life of me remember. The site is www (dot) texasarmor (dot) com I like the way the divs are spaced in IE but I don't know how to make IE and Firefox the same. Please help... Also, please if you could, any critiques? Suggestions? Thanks very much. -michael I've build a little nav that seems to work perfectly in IE, but is hated by FireFox. Specifically it seems like firefox is ignoring my margin and padding settings. Can anyone tell me what I'm doing wrong? Thank you. Code: <html> <head> <title>Untitled</title> <style type="text/css"> <!-- DIV{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding: 0;} .NavContainer { position:relative; padding:0em; width: 930px; height: 27px; margin:0em; background-image: url(images/nav/navBg.gif); background-repeat: no-repeat; } .NavLeftPad { position:relative; padding:0em; width: 87px; height: 27px; margin:0em; float:left; background-image: url(images/nav/spacer.gif); background-repeat: no-repeat; } .NavRightPad { position:relative; padding:0em; width: 87px; height: 27px; margin:0em; float:left; background-image: url(images/nav/spacer.gif); background-repeat: no-repeat; } .Nav2pxPad { position:relative; padding:0em; width: 2px; height: 26px; margin: 1px,0px,0px,0px; float:left; background-color:#54636D; } .NavLink { font-size:12px; color:#FFFFFF; font-family:arial,helvetica,sans-serif; text-decoration:none; font-weight:normal; line-height: normal; } .NavBlock { position:relative; padding: 7px,3px,0px,0px; height:26px; margin: 1px,0px,0px,0px; float:left; background-color:#54636D; text-align: right; } .NavWhatIsDermalounge {width:126px;} .NavOurTreatments {width:125px;} .NavOurClinicians {width:115px;} .NavLocations {width:92px;} .NavTechnology {width:96px;} .NavAboutUs {width:94px;} .NavMakeover {width:96px;} --> </style> <script language="JavaScript"> // On/Over state color #E46804 orange // Off state color #54636D nav-gray var theNavState = 'NavWhatIsDermalounge'; apAddLoadEvent(NavInit); function apAddLoadEvent(aponfunc) { var apoldonload = window.onload; if (typeof window.onload != 'function') { window.onload = aponfunc; } else { window.onload = function() { apoldonload(); aponfunc(); } } } function NavInit(){ if (theNavState != '') { document.getElementById(theNavState).style.backgroundColor = "#E46804"; } } function NavRollOver(theElement){ document.getElementById(theElement).style.backgroundColor = "#E46804"; } function NavRollBack(theElement){ if (theElement != theNavState) { document.getElementById(theElement).style.backgroundColor = "#54636D"; } else { document.getElementById(theElement).style.backgroundColor = "#E46804"; } } </script> </head> <body> <div id="NavContainer" class="NavContainer"> <div id="NavLeftPad" class="NavLeftPad"></div> <div id="NavWhatIsDermalounge" class="NavBlock NavWhatIsDermalounge"><a href="what_is.html" onMouseOver="NavRollOver('NavWhatIsDermalounge');" onMouseOut="NavRollBack('NavWhatIsDermalounge');" class="NavLink">What is dermalounge</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavOurTreatments" class="NavBlock NavOurTreatments"><a href="treatments.html" onMouseOver="NavRollOver('NavOurTreatments');" onMouseOut="NavRollBack('NavOurTreatments');" class="NavLink">Our treatments</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavOurClinicians" class="NavBlock NavOurClinicians"><a href="clinicians.html" onMouseOver="NavRollOver('NavOurClinicians');" onMouseOut="NavRollBack('NavOurClinicians');" class="NavLink">Our clinicians</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavLocations" class="NavBlock NavLocations"><a href="locations.html" onMouseOver="NavRollOver('NavLocations');" onMouseOut="NavRollBack('NavLocations');" class="NavLink">Locations</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavTechnology" class="NavBlock NavTechnology"><a href="technology.html" onMouseOver="NavRollOver('NavTechnology');" onMouseOut="NavRollBack('NavTechnology');" class="NavLink">Technology</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavAboutUs" class="NavBlock NavAboutUs"><a href="about.html" onMouseOver="NavRollOver('NavAboutUs');" onMouseOut="NavRollBack('NavAboutUs');" class="NavLink">About us</a></div> <div id="Nav2pxPad" class="Nav2pxPad"></div> <div id="NavMakeover" class="NavBlock NavMakeover"><a href="makeover.html" onMouseOver="NavRollOver('NavMakeover');" onMouseOut="NavRollBack('NavMakeover');" class="NavLink">Makeover</a></div> <div id="NavRightPad" class="NavRightPad"></div> </div> </body> </html> I've a menu bar that's a horizontally displayed list (i.e. set up with the following values: ul{ margin-top:5px; margin-bottom:5px; margin-left:0px; } li.inline { display:inline; padding-left:5px; padding-right:5px; border-left:1px solid #fff; } Contained in the following code: <div id="mainNav"> <UL> <li class="first"><a href="../about/index.html">About</a></li> <li class="inline"><a href="../contact/index.html">Contact</a></li> <li class="inline"><a href="../services/index.html">Services</a></li> <li class="inline"><a href="index.html">Portfolio</a></li> </UL> On IE 6.0 it does as required and there is no padding between the first element (About) and the left hand side of the page. BUT, on Firefox, about 5 characters worth of padding is between the left hand of the page and the first element. Is there a way to get both Firefox and IE to have no padding? Thanks </div> I am currently having to deal with a mystery padding at the bottom of each of my im_container tags... everything is set to 0px, and oddly enough... it looks GREAT in IE (ugghh... i can't believe i just said that)... it doesnt however look good in firefox... whats up... here is the XHTML followed by the CSS.. Code: <div class="im_left"> <div class="im_container"> <div class="im_logo"><img src="/images/im_icq.gif" alt="Contact Via ICQ" /></div> <div class="im_info"> 164149536 </div> <div class="clear"></div> </div> <div class="im_container"> <div class="im_logo"><img src="/images/im_aim.gif" alt="Contact Via AIM" /></div> <div class="im_info"> Incomplete Gamer </div> <div class="clear"></div> </div> </div> Code: .im_left {float:left; width:270px;} .im_container { margin:0 0 0 30px !important; border:1px solid #900; } .im_container a:link, .im_container a:visited, .im_container a:active, .im_container a:hover {color:#FFF;} .im_logo { margin:0px 0 0 0; float:left; width:30px; margin:0px; padding:0px; } .im_logo img {border:0px; margin:0px; padding:0px;} .im_info { font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; margin:0 0 0 5px; text-align:justify; width:200px; float:left; } .im_title { text-align:center; font-weight:bold; } For some reason, when I hover over images in the #content div of my site firefox is adding a strange little box to the bottom right hand corner of the image. The color of the box is the same color as my text hyperlinks which makes it more interesting. You can see the issue on my site. Here is the code that deals with the images in the #content div: Code: #content img { margin:2px 5px 0px 0px; } #content a img, #content a:visited img, #content a:active img { border:2px solid #6FA6D9; } #content a:hover img { border:2px solid #ffffff; } This issue is only happening on the images I insert from my wpg2 gallery. The images get one of the following classes applied to them: Code: .g2image_float_left { display:block; float:left; } .g2image_float_right { display:block; float:right; margin-left:5px; } Now I don't see how either of these could cause a problem but they have to be the issue considering this doesn't happen on images that don't have one of the above classes applied to them. Any ideas what is causing this? Thanks in advance. So, here's what I've got: http://www.anthonycarboni.com The header is supposed to appear 50 pixels high, flush with the top (no margins), with the header text middle aligned inside of it. This is working in IE 6 and 7, but is not working well in FF (mac/pc) or in Safari. Here is all code that pertains to that section. It is sure to be woefully poor, as I'm just getting into CSS: Code: body { color: #FFFFFF; background-color: #000000; font-family: 'ArialMT', 'Arial', sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 0; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; opacity: 1.00; padding-bottom: 0px; padding-top: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; min-width: 800px; } .main{ background-color: #202020; width: 800px; margin-left: auto; margin-right: auto; text-align: left; } .header{ height: 50px; background-image: url('images/header.jpg'); background-repeat: repeat; } p.headline { font-size: 32px; font-weight: bold; text-transform: uppercase; text-align: center; letter-spacing: 0.8em; vertical-align: middle; } And there you have it. I'm tearing my hair out over what I'm sure is some small thing that anyone with experience would notice immediately. Any help would be greatly appreciated. Thanks! |