I use to trust Firefox, but in this case, I don't know what to think. My
test page: http://gusgus.cn/test/index.html
IE6 does the right thing. The containting <div> is 600px, and within it,
there's one <div> of 400px and another of 200px, laying side by side.
The right <div> has padding on the left and right, to add some space
within the box, but Firefox (0.9.2) seem to confuse paddings as margins.
Here's the right <div> in my CSS:
#right {
float: right;
width: 200px;
overflow: hidden;
background-color: #DDDDFF; /* blue */
text-align: left;
padding: 8px 8px 8px 8px;
}
This box in Firefox is not 200 wide, but 216 (width + padding). It must
be a bug, or my understanding of margins and padding will crumble.
Gustaf 5 28858
Gustaf Liljegren wrote: I use to trust Firefox, but in this case, I don't know what to think. My test page:
http://gusgus.cn/test/index.html
IE6 does the right thing. The containting <div> is 600px, and within it, there's one <div> of 400px and another of 200px, laying side by side. The right <div> has padding on the left and right, to add some space within the box, but Firefox (0.9.2) seem to confuse paddings as margins. Here's the right <div> in my CSS:
#right { float: right; width: 200px; overflow: hidden; background-color: #DDDDFF; /* blue */ text-align: left; padding: 8px 8px 8px 8px; }
This box in Firefox is not 200 wide, but 216 (width + padding). It must be a bug, or my understanding of margins and padding will crumble.
Firefox is right. IE6 shows it wrong, but only because you are
triggering quirks mode. See
<http://gutfeldt.ch/matthias/articles/doctypeswitch.h tml> for details on
quirks and standard mode.
And see
<http://msdn.microsoft. com/workshop/author/css/overview/cssenhancements .asp>
for Microsoft's explanation of the differences, particularly
<http://msdn.microsoft. com/library/en-us/dnie60/html/cssenhancements .asp?frame=true #cssenhancement s_topic3>,
"Fix the Box Instead of Thinking Outside It"
If you remove the <?xml version="1.0" encoding="utf-8"?> line, you'll
trigger standard mode in IE6 and it will show the page the same way as
Firefox.
Matthias
Gustaf Liljegren <gu*****@algone t.se> wrote: I use to trust Firefox, but in this case, I don't know what to think. My test page:
http://gusgus.cn/test/index.html
IE6 does the right thing. The containting <div> is 600px, and within it, there's one <div> of 400px and another of 200px, laying side by side. The right <div> has padding on the left and right, to add some space within the box, but Firefox (0.9.2) seem to confuse paddings as margins. Here's the right <div> in my CSS:
#right { float: right; width: 200px; overflow: hidden; background-color: #DDDDFF; /* blue */ text-align: left; padding: 8px 8px 8px 8px; }
This box in Firefox is not 200 wide, but 216 (width + padding). It must be a bug, or my understanding of margins and padding will crumble.
Width 200px + left padding 8px + right padding 8px = 216px.
FireFox is right.
IE6 would also be right if you triggered Standards mode, at present
you trigger quirks mode and so it emulates the bugs in IE5 and puts
the padding inside the width. IE6 has a big whereby it triggers quirks
mode upon encountering the xml declaration before the doctype. Ditch
that and it will behave like FireFox (and Opera).
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Gustaf Liljegren wrote: I use to trust Firefox, but in this case, I don't know what to think. My test page:
http://gusgus.cn/test/index.html
This box in Firefox is not 200 wide, but 216 (width + padding). It must be a bug, or my understanding of margins and padding will crumble.
No, Firefox is doing it correctly, it should be 216px. As Matthias
already said, you're triggerring quirks mode in IE, which explians why
it's using the buggy, IE5/Win box-model. (See Tantek's box model hack [1]
The problem is that the full width of a box is calculated by:
(L = Left, R = Right, M = Margin, B = Border, P = Padding)
LM + LB + LP + Width + RP + RB + RM
So, your box width's are:
* #container:
LM + LB + LP + Width + RP + RB + RM
0 0 0 600px 0 0 0 = 600px
* #left:
LM + LB + LP + Width + RP + RB + RM
0 + 0 + 0 + 400px + 0 + 0 + 0 = 400px
* #right:
LM + LB + LP + Width + RP + RB + RM
0 + 0 + 8px + 200px + 8px + 0 + 0 = 216px
So, your #left + #right = 616px, which is wider than #container, so
there is no room for Firefox to fit #right where you want it to. The
easiest fix will be to reduce widht of #left and #right by a total of
16px, and everything should fit nicely. it works best if you set:
#right { width: 384px }
[1] http://www.tantek.com/CSS/Examples/boxmodelhack.html
--
Lachlan Hunt http://www.lachy.id.au/
Please direct all spam to ab***@127.0.0.1
Thank you.
On Mon, 09 Aug 2004 16:20:03 +0200, Gustaf Liljegren
<gu*****@algone t.se> wrote: http://gusgus.cn/test/index.html
IE6 does the right thing...
No it's not, provided that I have understood your question correct.
Here's the right <div> in my CSS:
#right { float: right; width: 200px; overflow: hidden; background-color: #DDDDFF; /* blue */ text-align: left; padding: 8px 8px 8px 8px; }
This box in Firefox is not 200 wide, but 216... ...a bug, or my understanding of margins and padding will crumble.
The total outside width of a <div> box is the sum of the values for the
following properties...
margin-left
+ border-left-width
+ padding-left
+ width
+ padding-right
+ border-right-width
+ margin-right
= total occupied width of any {display:block} type box
So your "understand ing of margins and padding" needs to be updated :-)
Most especially; the 'width' property suggests a width for the box
content only, all the other properties are added on the outside of that
inner content width.
<http://www.w3.org/TR/CSS1#block-level-elements>
--
Rex
Thanks a lot to everyone who help me with this question. Now I
understand what widths and heights really are.
But I can't help thinking IE had a good idea. The standard compliant way
means that everytime you use a little border or padding, you also need
to subtract the same amounts from the widths and heights = more fiddling
before you get it right.
Anyway, I'm glad to understand now.
Gustaf This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: StarQuake |
last post by:
At this site:
http://forwarding.robas.com
You can see in IE there is cell padding in 'Berkman Bedrijven' and with
Firefox there isn't. I don't want any cell padding.
Anyone?
--
-----------------------------------------
|
by: books1999 |
last post by:
Hi there,
I have a problem with this css/div and i cannot work it out. I would
like either container to be able to push the background box to grow but
in Firefox it overflows. Can someone find a solution to the problem
contained in the 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">
|
by: phil-news-nospam |
last post by:
Here is a simpler (no drop shadows) example of the padding bug I see:
http://phil.ipal.org/usenet/ciwas/2006-05-08/buttons-1.html
So far I find nothing in the CSS2 document that says I should get this
kind of inconsistent result.
--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
|
by: cbjewelz |
last post by:
Hey all.
So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical alignments and div widths are off. It's as if firefox has a different definition of a pixel than safari. Here is the url: http://theprize.chemouni.com/testing.php. When you select the Option from the pull down, the first part of the form appears. Then when...
|
by: autospanker |
last post by:
Ladies and Gentleman,
I have been having this problem that has been driving me insane. I have a website that when viewed in Firefox first, the content in the body area is pushed down. Then when you click refresh, the content on that page is fine. I believe this could possibily a firefox issue. When I load the website in IE6 or IE7 the content is just fine. Any page you visit with IEXporer displays correctly where as if you go to the start...
| |
by: Bouzy |
last post by:
I have a problem that I know gets asked about a lot. Its how my page differs in IE vrs. Firefox. I know IE sucks, but hears whats going on.
IE... http://i93.photobucket.com/albums/l75/Bouzy_Bouzy/IEGOLD.jpg
Firefox... http://i93.photobucket.com/albums/l75/Bouzy_Bouzy/FIREFOX.jpg
(Note the positioning of the text in the sidebars)
I hate the fact that my pages look sweet in Firefox, but not IE.. I don't even know what div is giving me...
|
by: pammyspammy |
last post by:
Hi -
Some background info:
I'm helping to redesign an internal website at work, and I've decided to use CSS, though I don't really have any experience with it. I figure now's a good time to learn...and what I know right now, I've pretty much learned in the last week or two.
At work, we have access to only two browsers, IE 6.0 and Firefox 2.0, so these are the only two browsers I can test the site in, and they're the only ones that...
|
by: littlealex |
last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS!
In IE6 the text for the following page doesn't display properly - rather than being aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly?
http://geekarama.co.uk/new_home.html
here is the code for new_home.html and following that the CSS...
|
by: Steve |
last post by:
Hi All
I have an asp.net 2.0 website with the following css file
It uses Master pages and in Firefox 3.04 for windows only, 3 of the web
pages don't display the Master page properly
The content page overlaps the Master page boundaries
In IE 6/7 All works fine
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |