CSS - Firefox Centering
could someone tell me why this greenish box doesnt centre in firefox?
ive looked in many other forums and the margin command seems to fix everybody elses but not mine. ive tried margin-left and right auto and that doesnt work either. i just want to centre a div (logoholder) inside another(topbody). thanks. CSS: body { padding: 0px; margin: 0px; } #topbody { background-color: #763721; height: 150px; margin:0pt auto; } #logoholder { background-color: #336666; background-repeat: no-repeat; height: 75px; width: 300px; } Similar TutorialsSeems like I'm always trying to get something to render correctly in IE but this time it's firefox that is acting ornery. There's not much to the page I'm working on. The table (#schoolstable) should be centered in the #mainbody div. Works in ie, fails in firefox. Here's my css: Code: /* = Default Layout -----------------------------------------------------------------------------*/ /* Remove padding and margin */ * { margin: 0; padding: 0; } /* Remove border around linked images */ img { border: 0; } body { text-align: center; min-width: 800px; font-family: Verdana, Arial, Helvetica, sans-serif; } /* = Basic Layout and Typography -----------------------------------------------------------------------------*/ h1 { margin: 8px 0; } h2 { margin: 8px 0; } p { margin: 4px 0; } ul { margin: 8px 0; } li { font-size:14px; } form { margin: 8px 0; } /* =Advanced Layout and Typography by Area -----------------------------------------------------------------------------*/ #wrapper { width:760px; margin: 0 auto; text-align: center; } #masthead { width:760px; margin: 0; background: url(../images/indexheader.jpg) no-repeat center; height: 270px; } #mainbody{ width:760px; margin: 0; text-align: center; } /* = Basic Links -----------------------------------------------------------------------------*/ a, a:visited { color: #000000; background-color: #EEEEEE; width: 150px; line-height: 18px; text-decoration: none; font-size: 14px; font-weight: bold; display: block; } a:hover, a:visited:hover { color: #FFFFFF; width: 150px; text-decoration: none; background-color:#00FF33; } /* = Advanced Links -----------------------------------------------------------------------------*/ .c0000FF a, .c0000FF a:visited { width: 150px; text-decoration: none; font-weight: bold; } .c0000FF a:hover, .c0000FF a:visited:hover { color: #FF6600; width: 150px; text-decoration: none; background-color: #0000FF; } .c990000 a, .c990000 a:visited { width: 150px; text-decoration: none; font-weight: bold; } .c990000 a:hover, .c990000 a:visited:hover { color: #FFCC00; width: 150px; text-decoration: none; background-color: #990000; } .cCC6600 a, .cCC6600 a:visited { width: 150px; text-decoration: none; font-weight: bold; } .cCC6600 a:hover, .cCC6600 a:visited:hover { color: #FFFFFF; width: 150px; text-decoration: none; background-color: #CC6600; } .c3366CC a, .c3366CC a:visited { width: 150px; text-decoration: none; font-weight: bold; } .c3366CC a:hover, .c3366CC a:visited:hover { color: #FFCC33; width: 150px; text-decoration: none; background-color: #3366CC; } .c333366 a, .c333366 a:visited { width: 150px; text-decoration: none; font-weight: bold; } .c333366 a:hover, .c333366 a:visited:hover { color: #CCCC99; width: 150px; text-decoration: none; background-color: #333366; } /* = Basic Lists -----------------------------------------------------------------------------*/ ul { list-style-position: inside; list-style-type: none; } ul li { } /* = Advanced Lists -----------------------------------------------------------------------------*/ .schoollist { text-align: center; } .schoollist li { line-height: 16px; padding: 1px 1px; width: 150px; } /* = Tables -----------------------------------------------------------------------------*/ table { border-spacing: 0; border-collapse: collapse; padding: 0; margin: 8px 0; } tr { padding: 0; margin: 0; } td { padding: 0; margin: 0; } /* = Advanced Tables -----------------------------------------------------------------------------*/ #schoolstable { } #schoolstable tr { } #schoolstable td { } /* = Forms -----------------------------------------------------------------------------*/ fieldset { } /* = Advanced Forms -----------------------------------------------------------------------------*/ This probably is an easy thing but I have tried a lot of things and I cant center the website on firefox. it looks good on internet explorer. When you open the website it positions itself on the center and even when you resize the browser. This is how I want it to behave in Firefox. The site is temporary on: http://www.danielyanez.com and the css is on: http://www.danielyanez.com/Stylesheet.css I appreciatte any help in advance and I hope someone can give me a hand, thanks !!!! I just coded this web page, by mistake I coded it with IE (usually i code for FF).. take a look: http://www.invalidheart.org/russell/home.html i want it to look how it looks in Explorer, any suggestions? 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 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. I am desperate. I think I found a bug in Firefox, and I'm not sure how to work around it. The following code works in everything (IE 8, Chrome, Safari, Opera) except Firefox (version 3.6.3). Am I doing something wrong, or is this a bug in Firefox? You can look what happens to the drop-down menu's on Menu 2 and 3 live by going to my site (deenfoxx dot com slash firefox-bug dot html). css Code: Original - css Code #main-nav { background-color: black; height: 40px; } #nav { position: relative; margin: 0; padding: 0; } #nav li { position: relative; float: left; display: table; width: 99px; height: 40px; border-right: 1px solid white; text-align: center; font-size: 10px; } #nav li:hover { background-color: darkred; } #nav a { display: table-cell; vertical-align: middle; line-height: 11px; font-weight: bold; text-decoration: none; color: #fff; } #nav li ul { position: absolute; padding: 0; background-color: gray; top: 40px; left: 0px; } #nav li ul li { width: 98px; border: 0; border-top: 1px solid white; } #main-nav html4strict Code: Original - html4strict Code <div id="main-nav"> <ul id="nav"> <li id="m1"><a href="#1">Main Menu 1</a></li> <li> <a href="#2">Main Menu 2</a> <ul> <li><a href="#2a">Sub-Category 1</a></li> <li><a href="#2b">Sub-Category<br/>with multiple lines</a></li> </ul> </li> <li> <a href="#3">Main Menu 3 with multiple lines</a> <ul> <li><a href="#3a">Sub-Category 2</a></li> </ul> </li> <li><a href="#4">Main Menu item which has a really long name on it</a></li> </ul> </div> <div id="main-nav"> The problem appears to be that "#nav li" happens to have position:relative; and a display:table; and "#nav li ul" is position:absolute;. Normally, absolute positioning requires its parent or ancestor position to be set, but when used with the table display, it doesn't work normally on Firefox--but it does on other browsers. Can someone help me with a workaround that does not involve altering the HTML? If I must, I will accept a workaround that requires changing the HTML, but I'll have to do some heavy duty recoding of Magento's core menu generation. Anyone that knows Magento knows I want to avoid that like the plague--my example is a very simplified version of the problem. Hi there, I am trying to center a div within a div. The container div needs to stretch 100% width. It works in FF, but not IE. Any ideas? This is my code: PHP Code: #top_bar{ background-image: url('img/top_bar.jpg'); height: 54px; font-family: arial; font-size: 14px; color: #ffffff; width: 100%; } #top_bar_content{ padding: 18px 0 10px 0px; width: 870px; margin: 0 auto; position: relative; } Hello, I have tried to use the auto margin to center a div within a div, but the auto margin only seems to work on the outermost div. Is there a workaround where I can center my content inside of a nested div? Take the example code: Code: <html> <head> <style type="text/css"> body { background-color: orange; } #container { width: 700px; margin: 0 auto; background-color: red; } #nested { width: 700px; margin: 0 auto; background-color: blue; } </style> </head> <body> <div id="container"> <div id="nested"> Text Here </div> </div> </body> </html> So I want the nested div to have its content centered, so "Text Here" is in the center. http://www.stevemedleyphotography.com/tempo/index.html What I am trying to do is make it so that the blue background is as it is already but the orange box is the full width of the window despite what resolution or window size the user has, and also is centered on the screen. -------BLUE--------- -------BLUE--------- -------BLUE--------- -----ORANGE------- -----ORANGE------- -------BLUE--------- -------BLUE--------- -------BLUE--------- Like that. I will be having some stuff within the orange div. I don't really know much CSS at all and am kinda guessing my way through it... poorly... Thanks for any help. This list is a navigation bar that displays tabs horizontally. I can't seem to figure out what properties I need to use to center it correctly. I have 2 problems: 1. How can I get these list items centered? 2. the second level seems to have problems displaying horizontally in IE. How can I fix it? Code: <div id="tablenavcontainer"> <div id="navcontainer"> <ul> <li><a href="/doctors/enroll/" rel="self" class="" id="purple" name="patientenroll">Enroll Patient</a></li> <li><a href="/doctors/patients/" rel="self" class="" id="current" name="doctorspatients">My Patients</a></li> <li><a href="/doctors/lab/" rel="self" class="" id="green" name="doctorlab">Lab</a></li> <li><a href="/doctors/pharmacy" rel="self" class="" id="yellow" name="doctorpharmacy">Pharmacy</a></li> <li><a href="/doctors/tools/" rel="self" class="" id="red" name="doctortools">My Office Tools</a></li> <li><a href="/doctors/home/" rel="self" class="" id="graphite" name="doctorhome">Home</a></li> <ul> <li><a href="/doctors/patients/currentchart.html" rel="self" id="currentchart" name="currentchart" >Current Chart</a></li> <li><a href="/doctors/patients/labhistory.html" rel="self" id="labhistory" name="labhistory" >Lab History</a></li> <li><a href="/doctors/patients/symptomhistory.html" rel="self" id="symptoms" name="symptoms" >Symptom History</a></li> <li><a href="/doctors/patients/prescriptionhistory.html" rel="self" id="prescriptions" name="prescriptions" >Prescription History</a></li> <li><a href="/doctors/patients/reports.html" rel="self" id="reports" name="reports" >Restore Reports</a></li> <li><a href="/doctors/lab/ordertesting.html" rel="self" id="ordertest" name="ordertest" >Order Testing</a></li> <li><a href="/doctors/pharmacy/prescribe.html" rel="self" id="orderrx" name="orderrx" >Prescribe</a></li> <li><a href="/logout.html" rel="self" id="" name="" >Log Out</a></li> </ul> </ul> <br style="clear: both;" /> </div> </div> Good day to you all, I'm working on a pop up css box. My problem is that I can't make it to be centered. Here is my code : PHP Code: echo "<a onmouseover=\"this.style.cursor='pointer'\" onfocus=\"this.blur();\" onclick=\"document.getElementById('$namess').style.display = 'block' \" >\r"; echo "<span><img src=\"http://ponder.peuplies.info/V_0-1/Art/".$imgdir."".$img."\" width=\"50\" border=\"0\" title=\"".$img."\" alt=\"".$img."\" /></span></a>\r"; echo "<div id=\"$namess\" align=\"center\" style='display: none; position: absolute; margin: auto; margin-left: auto; margin-right: auto; border: solid black 1px; padding: 10px; background-color: rgb(255,255,225); text-align: justify; color:#000000; font-size: 12px; '>\r"; echo "This is a CSS Popup that can be positioned anywhere you want on the page and can contain any test and images you want.\r"; echo "<img src=\"http://test.com/Art/".$imgdir."".$img."\" width=\"50\" border=\"0\" title=\"".$img."\" alt=\"".$img."\" />"; echo "<br />\r"; echo "<div style='text-align: right;'><a onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('$namess').style.display = 'none' \" ><span style=\"text-decoration: underline; color:#000000;\">Close</span></a></div>\r"; echo "</div>\r"; Can somebody help me ? Now while I did manage to work this out with margins and paddings, I have to ask how to do it properly. It's very basic. You have blank page. No wrappers no nothing. Then 1 div, holds, 1 ul, with 20 li. The div has specified width. How to center the ul inside the div? I need the UL to NOT have specified width since I'll be adding more items to it over time. Thanks! I was wondering how I could center a CSS div so I would have one column going thorugh the middle. I tryed using "center" in the CSS but that didn't work and then I read some where else about floats and how they will make every go to either the left or right. How would I go about centering a Div like that? Thankyou for any help. Hi, i am new to CSS and want to know about how to center a div tag for example i have the following code Code: <div style=""> </div> if i want to place this div in the middle of the browser window that is from equal distance from left right top bottom what will i have to put inside the style attributes. Please recommend Regards ltoso How can I, let's see how to say this. Align text to the middle of a div (up and down)... not really a center Normal: ________________________________ Text ________________________________ After: ________________________________ text ________________________________ THANKS Hi all, this is my CSS: Code: body { font-family:arial; font-size:14px; background-color:#FFFFFF; margin: 0; padding: 0; } .mainbar { position:absolute; height:100%; width:600px; display:block; background-color:#F2F2F2; top:0px; bottom:0px; z-index:0; border-top: 0px solid #000000; border-right: 1px solid #000000; border-bottom: 0px solid #000000; border-left: 1px solid #000000; } .contact { position:absolute; display:block; height:40px; width:600px; background-color:#FFFFFF; top:80%; bottom:0px; z-index:0; border-top: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; } .logo { position:absolute; display:block; height:200px; width:600px; background-color:#CCCCCC; top:10%; bottom:10%; border:1px solid #000000; z-index:2; } .logoborder { border-top: 0px solid #000000; border-right: 1px solid #000000; border-bottom: 0px solid #000000; border-left: 1px solid #000000; } Now how do I go about centering all of this? I have put many frustrated hours into this, and have tried everything that could have a possibility of working but have come out with nothing. Any help would be appreciated! Please, I have read other forum posts and it is not clear what to do, so treat me like i'm 5 years old!!! Thanks! Jack. im trying to center this div but im not to sure on how to do it Code: <style type="text/css"> div.img { margin:2px; border:1px solid #0000ff; height:auto; width:auto; float:left; text-align:center; } div.img img { display:inline; margin:3px; border:1px solid #ffffff; } div.img a:hover img { border:1px solid #0000ff; } div.desc { text-align:center; font-weight:normal; width:120px; margin:2px; } </style> </head> <body> <div class="img"> <a target="_blank" href="klematis_big.htm"> <img src="klematis_small.jpg" alt="Klematis" width="110" height="90" /> </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="klematis2_big.htm"> <img src="klematis2_small.jpg" alt="Klematis" width="110" height="90" /> </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="klematis3_big.htm"> <img src="klematis3_small.jpg" alt="Klematis" width="110" height="90" /> </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="klematis4_big.htm"> <img src="klematis4_small.jpg" alt="Klematis" width="110" height="90" /> </a> <div class="desc">Add a description of the image here</div> </div> Hey. I'm having issues with getting my page to center in IE7 using margin: auto; It works fine in firefox. The page is at http://jbench.co.uk:81/. The CSS is at http://jbench.co.uk:81/css/css.php . The section where i think the problem is: CSS Code: Original - CSS Code #page { width: 900px; margin: 0 auto; padding: 14px 3px; min-height: 250px; font-size: 1.2em; } #page { Any help's appreciated. Hey everyone, I am fairly comfortable with HTML, and even know a decent amount of PHP and Javascript. But sometimes trying to do the simplest things in CSS makes my head spin! (this is one of those times). I've got a "scrolling" header at the top of a page (stays visible even when scrolling), and am trying to center a DIV (which contains opt-in forms) inside that header. It looks good when my browser window is maximized (at 1280x1024 resolution). But when I minimize the browser or check it in other screen resolutions, the "centering" of the opt-in forms are off. Here is the page... www.wordflood.com/Test/Scrolling_Header.html And here are the CSS includes... www.wordflood.com/Test/style.css www.wordflood.com/Test/IE6_style.css This was really just a quick hack from a "scrolling header" demo I found online, so I must have overlooked something. Any ideas? |