473,836 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Padding and Margin. Could someone, please, help me out? Thank You.

Hello,

I created a div with margin and padding and a fixed width.
It seems the behavior is different in Firefox and IE.

I am not sure but it seems:
True width = width + paddingORmargin
OR
True width = width

Could someone, please, clarify this for me?

Thanks,
Miguel

Dec 7 '06 #1
2 1906

shapper wrote:
It seems the behavior is different in Firefox and IE.
Find a good CSS website ( www.brainjar.com
www.positioniseverything.com ) and read up on "quirks mode" and "box
model"

Dec 7 '06 #2
On 2006-12-07, shapper <md*****@gmail. comwrote:
Hello,

I created a div with margin and padding and a fixed width.
It seems the behavior is different in Firefox and IE.

I am not sure but it seems:
True width = width + paddingORmargin
When you say "true width" you mean the width measured from outside the
margin area? In that case, this is the conforming interpretation.
OR
True width = width
I think some versions of IE do that if you don't use strict mode. In
other words, when you set width you're setting the width you'd like the
box to be outside its margin and padding.

Always use strict mode, just put

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

very first thing in each HTML document.
Could someone, please, clarify this for me?
But... for table cells and tables the "width" property sets the outer
width, even in strict mode in Firefox.

I suspect this comes down to a difference between the HTML and CSS
specs. The HTML spec says that the "width" attribute on a table means
"the desired width of the entire table".

The width attribute is usually mapped directly to the CSS width
property. In other words:

<table width=400>

is equivalent to

<table style="width: 400px">

in the former case, 400 should refer to the "entire width", but in the
latter case, to be consistent with the fact that in CSS a table is
supposed to behave mostly like a block box, 400px should refer to the
inside-padding width.

So browsers have a problem: either break the simplicity of the mapping
between the HTML width attribute and the CSS width property, or treat
CSS widths differently for tables. They mostly do the latter.
Dec 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
29248
by: delerious | last post by:
I'm trying to add some simple padding to an IMG by using a padding-right style, but it doesn't work in IE. Works fine in Mozilla and Opera, though. Here's a link to a page which displays this IE problem: http://home.comcast.net/~delerious1/index12.html I do know that I can solve the problem in IE by changing padding-right to margin-right, but then the links cannot be clicked when the mouse is over that margin area. So I would...
36
3064
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/ |
10
12916
by: Alan Silver | last post by:
Hello, In my (seemingly) endless quest to understand CSS, I have yet another problem. Please look at http://www.kidsinaction.org.uk/ph/x.html in Opera, where you will see it how I expected. If you look at it in IE (6 or 7), you find it also looks fine, except for the top margin missing from the links across the top of the page. That's not the main issue here, but any pointers as to why it doesn't show them would be appreciated.
11
6881
by: sllrphoto | last post by:
A veteran of early html, I've modified my blog template and made it look rather clean (albeit rather plain) when viewed with IE. Ironically, I'm a big Firefox fan, but when viewed in FF, my blog leaves a lot to be desired. The blog (which is at http://lazycomic.blospot.com/ ) is a basic two column style, with the right column being the one that's giving me the problems.
3
6507
by: Daz | last post by:
Hi everyone. I have just been making a JavaScript chat applet, which should open in a new child window. It does all of this fine, and works within Firefox beatifully. However, IE thinks it's necessary to stop my iFrames from spaning the entire length and width of the Window, and add about 7-8mm of padding/margin to the inside of the Window. I can't figure out, whether it's adding it to the inside of the window, or the outside of the...
0
1404
by: adminloozer | last post by:
Hello, I've some difficulities when using padding or margin to position an element (alone on page alongside other elements OR inside another parent element). Can I say usually I will use margin to position or create some room between parent elements and padding to position or create some room between a parent element and child elements like a header with its links bar, search div, image div... If someone can tell me when using margin...
12
16100
by: Koelner | last post by:
Hello all, am very frustrated because I can't get a simple table to display the same way in both browsers. It displays the way I want it to in Firefox but not in IE7 (Windows XP). 1) not sure if my doctype is correct- this is just a plain vanilla html page, so I used <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> 2) I have tried to put cell padding=0, margin=0 on the table...
11
2383
by: maya | last post by:
hi, I've been noticing lately that padding property is ADDING to dimensions of element, this is causing me lots of difficulties.. if for example I have this: <div class="divMore" align="right"><a href="">Read More</a></div> and in css:
8
2891
by: rodeored | last post by:
page: http://reenie.org/test/blockpadding.htm code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>test</title> </head> <body> <h2 style='padding:0; border:solid 1px red;'>A bunch of text</h2> </body> </html>
0
10860
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10604
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,...
0
10261
tracyyun
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...
0
9389
agi2029
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...
1
7796
isladogs
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...
0
6984
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();...
1
4466
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
2
4026
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.