|
Posted by Andy Dingley on 02/22/07 12:56
On 22 Feb, 11:26, "UKuser" <spiderc...@yahoo.co.uk> wrote:
> Can someone tell me what the default margins & heights are for the p
> tag please.
There are no "defaults" because there's no standard imposed on how
browsers should treat this. It's up to the browser author.
You might find this interesting though
http://www.w3.org/TR/CSS21/sample.html
It's a _suggested_ default style sheet for HTML.
In it we find that
p { margin: 1.12em 0; }
Note that the CSS-defined initial values (in the absence of a
stylesheeet) for padding are 0. These _are_ part of the formal
normative recommendation, unlike the suggested default stylesheet.
Also line-height has a normative initial value of "normal" which is
recommended (again a flexible suggestion, like the stylesheet) to
between 1.0 and 1.2. This fits with the default stylesheet value of
initial top and bottom margins being "one line height" rather than "1
em", as is often thought.
In practice the default stylesheet can generally be assumed to apply
to all desktop browsers, at least as far as it's _necessary_ to assume
anything about it. Assume it will be reasonable and workable, unless
you have a reason to start deliberately setting things differently.
<p> will be rendered in much this way across all common browsers. <li>
though is known to vary even between common browsers. Some default by
setting biggger margins on it, others do it by setting padding. If you
adjust either <li> settings, make sure that you take _both_ margin and
padding into the explicit control of your stylesheet.
Obviously it's all likely to be radically different for "non-
traditional" browsers and display devices.
Navigation:
[Reply to this message]
|