CSS - Css Div Width Difference Between Mozilla And Ie
Hey, I'm designing using an XHTML/CSS based layout and I've noticed that the following CSS shows slightly different results on Mozilla and IE:
Code: .box { position:relative; width:600px; padding:5px; border:1px solid black; } Applying this to a DIV will display a 600 pixel wide box on IE. On Mozilla (Firefox, etc) though, it'll be 612 pixels wide. This is because Mozilla is adding the padding and borders to the initial width. I would like Mozilla to display the same as on IE, so I recoded: Code: .box { position:relative; width:589px; padding:5px; border:1px solid black; } *html .box { width:600px; } This works, although it looks a little bit like a quick hack. Is there any other way of doing this? And also, which browser, in this case, isn't following standards correctly? Thanks, Ralph Similar TutorialsI have an odd situation where the box for an anchor in a menu is extraordinarily large . . . IN MOZILLA! IE works as expected & displays correctly, but the Mozilla box is triggering the :hover half way in the content area! (See attachment) I'm a little baffled on this box situation, EVEN INCLUDING the box-sizing changes for both IE/Moz (box-sizing: border-box & -moz-box-sizing: border-box), still doesn't resolve the problem. Any feedback is greatly appreciated! Here is the relevant CSS: Code: body, html { min-width: 700px; background: url(/_test/images/nav-filler.gif) repeat-y; height: 100%; font: 1.2em Verdana; line-height: .8em; margin: 0 0 0 0; padding: 0 0 0 0; } p, a, div { font-size: 76%; padding: 0 10 0 0; box-sizing: border-box -moz-box-sizing: border-box; } #header { position: absolute; top: 0; left: 0; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 200; /*border: 1px solid #0F2B5B;*/ } #header-right { position: absolute; top: 0; right: 0; z-index: 100; width: 100%; background: url(/_test/images/header-filler.gif) repeat-x; margin: 0 0 0 0; padding: 0 0 0 0; } #content { position: absolute; top: 154; left: 163; z-index: 300; margin: 0 0 0 0; padding: 0 10 0 0; } #left-nav { position: absolute; top: 154; left: 0; right: 163; margin: 3 0 0 0; padding: 0 0 0 0; max-width: 163; display: block; } #nav-links { margin: 0 0 0 0; padding: 0 0 0 0; width: 133; } #left-nav a { color: #000000; font: 69% Verdana; background: url(/_test/images/nav-item3.gif) no-repeat 0px 0px; margin: 0 0 0 0; padding: 0 17 4 29; width: 155; text-decoration: none; display: block; box-sizing: border-box -moz-box-sizing: border-box; } #left-nav a:hover { color: #FF0000; background: url(/_test/images/nav-item3.gif) no-repeat 0px -50px; } #left-nav a:active { color: #FF0000; background: url(/_test/images/nav-item3.gif) no-repeat 0px -100px; } #left-navContent { color: #000000; font: 66% Verdana; width: 163; background: url(/_test/images/nav-item-filler.gif) repeat-y 0px 0px; margin: 0 0 0 0; padding: 0 30 4 29; text-decoration: none; } .nav-itemBottom { margin: 0 0 0 0; padding: 0 0 0 0; } .nav-header { color: #0F2B5B; font: bold 80% Verdana; margin: 00 20 0 0; padding: 7 0 6 32; width: 163; text-decoration: none; display: block; } #nav-headerType1 { color: #0F2B5B; background: url(/_test/images/nav-header.gif) no-repeat 0px 0px; } #nav-headerType2 { color: #0F2B5B; background: url(/_test/images/nav-header.gif) no-repeat 0px -30px; } #nav-headerType3 { color: #FF0000; background: url(/_test/images/nav-header.gif) no-repeat 0px -60px; } #nav-headerType4 { color: #0F2B5B; background: url(/_test/images/nav-header.gif) no-repeat 0px -90px; } #nav-headerType5 { color: #FF0000; background: url(/_test/images/nav-header.gif) no-repeat 0px -120px; } Is there a size difference between css pixels and html width pixels? The question I ask is because I am using the embed code from flickr and vimeo`s width of 220 and the search input bar in css is set to 220px, but when viewed through a browser they have different lengths. Is there a solution for making it the same length? I have designed one page. I am getting correct behavior in IE but there is some problem with Mozilla. Here is the code sample: <DIV class=ColumnHeader><SPAN class=noSort style="WIDTH: 6%; TEXT-ALIGN: center"><input type=checkbox id=chkSelAllAvail value="" name=chkSelAllAvail></SPAN> <SPAN style="WIDTH: 20%">Year</SPAN> <SPAN style="WIDTH:36%">Type of Report</SPAN> <SPAN style="WIDTH:24%">End Date</SPAN></DIV> I have attached both screen shots of IE and Mozilla. Can anyone help me ?? Hi, I have hit the "wall" in my knowledge of CSS while trying to implement a "flex-width-equal-height-sidebar-layout" style of layout as a skin/theme for a message board system and need some help. My trouble occurs when a direct link to the post is used (instead of following the menu navigation system) where the top menu information/links area (the area between the banner and the post) is chopped off... The relevant portion of the CSS seems to be the .col_wrap {margin-top: 10px; border: 0; overflow: hidden; float: left; width: 100%; position: relative; z-index: 10; clear: both;} portion of my CSS because if I take out the overflow:hidden declaration then the menu portion of the skin/theme/layout shows correctly but the sidebar the shows the part which should be hidden at the bottom and the footer completely vanishes from view! My apologies but this is the best I can do without having the ability to post pics or urls which could better explain what is wrong and frankly speaking I don't know how anyone here can help given my inability to show the problem but hopefully someone knows or has run into this problem before or can offer some resources that may be of assistance.... i ve been playing with my page and been trying to modify the width of the page (divs) according to the browswer's width. The problem is i want the navigation menu on left to be fixed width (say 200px) and the center div and the right column to be variable width. Also, i want to set a minimum width , so that the floating divs dont roll below the navigation menu. here s the link to the page. try reducing ur browser windows size . the content div rolls down under theleft nav menu. http://ccc.1asphost.com/pacemakerpr...r/cicuitlab.htm Also , i get wierd result in netscape navigator. please help I have an absolutely positioned <div> containing a block of text. I have not specified a width for this <div>. This <div> is nested within another <div> for which I have specified a width of 200px. So something like: html4strict Code: Original - html4strict Code <div style="position: relative; width: 200px;"> <div style="position: absolute; top: 10px; left: 20px; z-index: 100;"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur eu purus a tellus mollis consequat. Phasellus aliquam sapien quis mauris. </div> </div> <div style="position: relative; width: 200px;"> Since the absolutely positioned <div> is not part of the page's normal flow, I would expect that its width would expand according to its contents (and the browser window's boundries). Instead, in Firefox only, the width of the absolutely positioned <div> expands only to the width of its parent - in this case 200px. Am I doing something wrong? or is there a workaround for this? I have seen a design which I find pretty interesting where in the main site is aligned left and fixed width at say 700px wide. Yet the footer seems to span the entire screen. The header also seems to use the entire screen width but that is beign accomplished with the background image, but this footer goes all the way to end of the screen and naturally adjusts itself under all the content. Is there a way to get this effect? Ok. Here's the problem: I have a asp.net 1.x datagrid inside a floated div and I want the datagrid to stretch the width of the div. This div is in the center of two other floated divs. Is there a way to make a table go 100% the width of its container div? Css code: Code: /* left bar: */ #navBar{ width: 185px; float: left; } /* right bar: */ #rightModulesContainer { width: 130px; margin: 0; padding: 0px 0px 0px 10px; float: right; } /* center content: */ #content{ padding: 0px 5px 0px 0px; margin-top:0; margin-bottom:0; margin-left:4px; margin-right:0px; float: left; text-align:left; /*display: inline;*/ } /* contained in #container: */ #dataGridContainer{ margin: 0; padding-bottom: 10px; min-width:360px; } .categoryGridStyle { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-style: normal; color: #000000; width:100%; } and here is the layout of the divs: Code: <div id="navBar">left navigation bar here (tree view)</div> <div id="rightModulesContainer">right side bar here</div> <div id="content"><div id="dataGridContainer">datagrid here</div></div> Thanks for your help in advance. I've been messing with this for a while - trying to get it to work cross browser is driving me nuts. I've tried placing the divs in containers and floating the containers, I've tried everything I can think of... I'm at the very very very begaining of a table-less design (my first, actually). The problem is, since I have decided to have a non-fixed width, when the browser is minimized, at a certain point the design breaks. See it here (please don't make fun! it's just the start): SiliconSatan.com/test.php I'd like to set a minimum width, probably on the container <div>, so at a certain point it sort of becomes like a fixed width? No smaller than a set width? [EDIT] Also, I have a question about background color mismatch, but it was not quite OT for the CSS forum: http://forums.devshed.com/web-desig...e7t-403266.html Hello, (please also see attached/uploaded style sheet) I'm puzzled why (in the following code) the TEST #2 table renders as required (i.e. 2 rows in 1 column, all with the same cell WIDTH) but the table in TEST #1 seems to render the table cells (i.e. 2 columns in 1 row) without a common cell WIDTH. How can I get all the cells (there are plenty more!) in table TEST #1 to all be exactly the same width (preferably 85px)? Code: <link rel="stylesheet" type="text/css" href="http://thinet/cgi-bin/thinetStyleSheet.css"> TEST #1 <table class="menu" border=1 CELLPADDING=2> <tr> <td class="pinkButtons"><a title="Treats menu" href='http://thinet/theread/forumdisplay.php?s=&forumid=82'>Treats</a></td> <td class="pinkButtons"><a title="New Starters, Leavers and Transfers" href='http://thinet/theread/forumdisplay.php?s=&forumid=41'>Joiners etc.</a></td> </tr> </table> <P> TEST #2 <table class="menu" border=1 CELLPADDING=2> <tr><td class="pinkButtons"><a title="Treats menu" href='http://thinet/theread/forumdisplay.php?s=&forumid=82'>Treats</a></td></tr> <tr><td class="pinkButtons"><a title="New Starters, Leavers and Transfers" href='http://thinet/theread/forumdisplay.php?s=&forumid=41'>Joiners etc.</a></td></tr> </table> I don't think I've quite grasped the idea of CSS yet?!?! Any help/pointers would be appreciated. Thanks, Andy I have a header div with a background image - it's basically a pair of hands holding a banner - the arms extending to the sides of the window. I'm trying to work it so that, no matter how wide or thin the window, the arms will always extend to the sides. So when you make it smaller, the image will disappear beyond the viewing window. This happens automatically on the right-hand side, but the image is stopping it on the left. Is there a way to set a min-width, which is smaller then the image itself, so that when the window is shrunk the image starts to disappear on either side until it reaches the min-width? I'm trying to get it so the arms will disappear and stop at the hands. Or can anyone suggest an alternative solution? I tried to do it with background and header image, with the arms on the background, so when the top image moves it looks like the arms move with it. That worked great until I started using a patterned background. Full width: |---------------------------------------| |AAAAAAAAHHH BBBBBBBBBBBBBB HHHAAAAAAAAA| |---------------------------------------| Shrunk width: ------- |------------------------| -------- AAAAAAA |AHHH BBBBBBBBBBBBBB HHHA| AAAAAAAA ------- |------------------------| -------- Grey bit outside window edge. | Window side A Arms H Hands B Banner I hope that makes sense. I expect there's an easy solution but I've been trying to figure it out for several hours and could do with someone else's perspective. Thanks. I have a page with an ASP.NET Gridview on it...this Gridview is located in a child DIV inside a parent DIV. That Gridview can often go wider than the parent DIV width set. In IE6 the MAINDIV (Parent DIV) would expand to fit the expanded Gridview contained within the child DIV. In IE7 the DIV will not expand so it overlaps the DIV and looks bad. I want that MainDiv to dynamically grow with the child DIV width, like it did in IE6. Please see my code below. I want the MainDiv to remain ~800px unless it is pushed out further. Thanks for any ideas on a fix for this. Whenever I try min-width it just blows the parent DIV out to 100% screen size. Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> </head> <body style="width:100%;text-align:center;background-color:#68838B" onload="loadpage();"> <form id="frmMain" runat="server"> <div id="mainDiv" style="position:relative;top:10px;width:800px;height:auto; background-color:white;border:solid 1px #666666"> <div id="contentDiv" style="text-align:left;width:797px; padding:3px 3px 3px 3px;"> <asp:ContentPlaceHolder ID="contentBody" runat="server"></asp:ContentPlaceHolder> </div> </div> </form> </body> </html> What is the difference between these two: .itemBox #itemBox I'm trying to figure out what the difference is between these variables. Hi! What is the difference between these two snippets of code? <ul> <li>...</li> <li>...</li> <li>...</li> </ul> and <ol> <li>...</li> <li>...</li> <li>...</li> </ol> I know ul stands for unordered list and ol for ordered list but the two examples above are the same, right? Thanks for taking the time to read my question. My page has a container with only the left and right borders showing. I want to center it. If I put in margin values that look right in FF, they are way off in IE. I suspect that there is a difference in where IE starts counting from and where FF starts counting from. FF seems to be counting from the parent container, where as I am not sure where IE is counting from. How can I fix this? Thanks, Brad HTML: Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="piercedjunkmail@hotmail.com"> <meta name="generator" content="AceHTML 5 Freeware"> <link href="TestLayoutCSS.css" rel="stylesheet" type="text/css" /> <title>Test Layout 1</title> </head> <body> <div id="HeaderContainer"></div> <div id="PageTitle">This is the title of the page</div> <div id="MajorLeftMainContainer"> <div id="LeftMainContainer"></div> <br /> <br /> <br /> <br /> <br /> <br /> <hr class="CenterVert" /><br /> <hr class="CenterVert" /> </div> <div id="MajorRightTopContainer"> <div id="RightTopContainer"></div> <div id="VertLines"></div> <div id="RightCenterContainer"></div> <div id="VertLines"></div> <div id="RightBottomContainer"></div> </div> </body> </html> CSS: Code: @charset "iso-8859-1"; body { font-family: Foo, times, serif; margin: 0px; background-color: #4F9FC5; } #HeaderContainer { height: 50px; width: 100%; /*border-color: green; border-style: solid; border-width: 2px;*/ } #MajorLeftMainContainer { float: left; margin-top: 90px; margin-left: 10px; /*width: 68%;*/ width: 670px; height: 310px; /*background-color: #4F9FC5;*/ background-color: yellow; } #LeftMainContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: left; width: 80%; height: 300px; background-color: #EAEAEA; } #MajorRightTopContainer { float: left; margin-top: -50px; margin-right: 10px; width: 30%; height: 580px; /*background-color: #4F9FC5;*/ background-color: green; } #RightTopContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: left; width: 97%; height: 150px; background-color: #EAEAEA; } #RightCenterContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: left; width: 97%; height: 150px; background-color: #EAEAEA; } #RightBottomContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: left; width: 97%; height: 150px; background-color: #EAEAEA; } #PageTitle { font-size: 25px; font-family: arial, times, serif; /*border-color: green; border-style: solid; border-width: 2px;*/ width: 340px; height: 35px; margin-top: 40px; margin-left: 25px; color: black; font-variant: small-caps; } #VertLines { border-left-width: 4px; border-left-color: #66CDFF; border-left-style: solid; border-right-width: 4px; border-right-color: #66CDFF; border-right-style: solid; float: right; width: 35px; height: 50px; margin-right: 100px; } hr.CenterVert { vertical-align: middle; border-width: 2px; border-style: solid; border-color: #4F9FC5; } I'm kind of clueless right now because for my CSS code, the gap between the header and the navigation bar is completely different for Firefox than IE. I designed it in IE (which was probably a mistake in hindsight) so that's the browser it appears fine in, but in Firefox the gap is about 2-5 pixels. I've looked at all the resources online, but still can't figure out how to fix the code, so if someone could edit the code below so it works I'd be greatly thankful. Cheers. CSS Extract: Code: #wrapper, #content-wrapper { float: left; width: 100%; } #header { height: 100px; padding: 15px 0 5px 0; background: url("http://talkpw.com/images/index_02.gif"); vertical-align: middle; } #navbar { height: 28px; border-bottom: 1px solid #ccc; background: url("http://talkpw.com/images/index_08.gif"); } .in { margin: 10px; /*Margins for inner DIV inside each column (to provide padding)*/ margin-top: 0; vertical-align: middle; } .ina { margin: 5px; /*Margins for inner DIV inside each column (to provide padding)*/ margin-top: 1; vertical-align: bottom; } .navtext a:link, .navtext a:visited, .navtext a:active{ color: #FFFFFF; text-decoration: none; vertical-align: bottom; } .navtext a:hover{ color: #FF0000; } HTML: Code: <div id="wrapper"> <div id="header"> <div valign="top" class="in"> <img src="http://www.talkpw.com/images/logonew.gif"> </div> </div> <div id="navbar"> <div class="ina"><span class="navtext"><font face="Tahoma" size="2" color="#FFFFFF"><a href="http://www.talkpw.com/index.php" style='text-decoration: none;'>Home</a> | <a href="http://www.talkpw.com/forums">Forums</a> | <a href="http://www.talkpw.com/videos.php">Videos</a> | <a href="http://www.talkpw.com/forums/index.php?autocom=arcade">Arcade</a> | <a href="http://www.talkpw.com/links.php">Links</a> | <a href="http://talkpw.com/forums/index.php?act=Reg&CODE=00">Register</a></font></span> </div> http://www.justusvizslas.com/CrossTies/cttemplate.php I'm working on a new site and am trying to get a basic template set up. In my navigation menu I notice a height difference where the tabs are located. In FF it appears that the #navigation or .menu div has a slightly larger height than in IE, which just closes the height snug with the height of the tabs themselves. Can someone explain why this is the case and how/if I can correct it so that it shows up the same in both browsers? Can anyone help explain why my menu is displaying differently in FF and IE? I've done some research and tried a few hacks, I cannot figure this one out. http://www.departurestudios.com/playground/ Firefox Screenshot - http://www.departurestudios.com/playground/ff_screen.jpg IE Screenshot - http://www.departurestudios.com/playground/ie_screen.jpg My goal is to get it to look like it does in FF. Thanks. Hello, I am trying to get my drop down boxes to line up properly and it is not working out for me in IE. Firefox looks alright, but I am having trouble getting it to line up in IE. Can someone please take a look at This Example and advise me on anything you see that is out of place. Thanks for the insight. webg Okay so I have a basic CSS navigation panel on the left-hand side of my webpage. Basically I surrounded an <li> tag with a solid border so it's a rectangle with some text in the middle (ie. about, home, contact us, articles, etc) and I linked it using an <a> tag: Example: Code: <ul> <a href="home.html" class="button"><li>HOME</li></a> <a href="about.html" class="button"><li>ABOUT</li></a> ... </ul> Then for CSS: Code: #navigation ul { width: 128px; list-style: none; margin: 0; padding: 0; } #navigation li { background: #CCC; padding-left: 5px; margin-top: 5px; border: 1px solid #000; border-left: 10px solid #336699; } #navigation a.button { color: #333; text-decoration: none; } #navigation a.button:hover { color: #FFF; } The url is: Wolfenzon Schulman It's a website for a firm I work for. So basically, on the FF edition, the buttons work as intended, the entire <li> tag is linked (<a>'ed) and you can click on any part of it to activate the :hover and follow the link. The IE version, you can only hover over the text and anywhere before that (probably because of the padding-left: 5px associated with it). No matter what I've seemed to come up with, the IE version will just not cooperate. |