View Full Version : Why remove all margin and padding?
JorisA
8 Jun 2007, 5:15 AM
The core css removes all margin and padding:
html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
For most element I can understand why, but why tags like P? Aren't they supposed to put a margin at the end of each paragraph??
mystix
8 Jun 2007, 5:46 AM
refer to the docs for YUI's Reset CSS (http://developer.yahoo.com/yui/reset/)
Hi JorisA,
This topic has been discussed in existing threads, such as this one: Why reset? (http://extjs.com/forum/showthread.php?t=5927&highlight=css+default+reset).
Basically, the problem is that not all browsers apply the same default margins & paddings to the document elements, including P of course, and so some web designers have decided that it's better to start from zero (literally!) and apply styles as you need them.
Naturally, different people have different ideas of what the ideal reset.css should be. You have for example YUI's approach (linked by mystix above), and also, to cite another conspicuous example, Eric Meyer's approach:
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
http://meyerweb.com/eric/thoughts/2007/04/14/reworked-reset/
http://meyerweb.com/eric/thoughts/2007/04/12/reset-styles/
EDIT: BTW, in case you don't know Eric Meyer, visit his website (http://meyerweb.com/eric/css/) to have an idea of how much he's been involved with CSS. :)
EDIT 2: Ah, and I forgot... HTML tags are not supposed to put margins or anything! Their purpose is to markup (as semantically as possible) your content. How each document element looks is a job for CSS. Well, at least, that's how things were designed to be.
mystix
8 Jun 2007, 6:31 AM
Hi JorisA,
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
http://meyerweb.com/eric/thoughts/2007/04/14/reworked-reset/
http://meyerweb.com/eric/thoughts/2007/04/12/reset-styles/
EDIT: BTW, in case you don't know Eric Meyer, visit his website (http://meyerweb.com/eric/css/) to have an idea how much he's been involved with CSS. :)
woah... more great links to add to our ever growing arsenals. thanks! :)
JorisA
8 Jun 2007, 6:49 AM
Hmm something for the wiki?
Thnx allot.
dnixon
8 Jun 2007, 9:36 AM
Yes - perhaps those who start threads with questions or problems that are answered/solved could add a paragraph summary of the thread to an appropriate place in the wiki with a link back to the full thread and similar threads. If there is one forum post of sufficient quality like efege's post above, maybe copy it or just link to it directly, or edit/add e.g. mystix' YUI docs reference.
If we all wrote summaries of the threads we have started that would be a big start. Maybe aim to write one summary per day/week or whatever.
Dave
It's in the wiki now (http://extjs.com/learn/Manual:Stylesheet).
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.