Afficher un message
Vieux 18/03/2008, 00h18   #2
Jeremy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to display the margin of a <p> element

Summercool wrote:
> The <p> is suggested in CSS Spec 2.1 to have a margin of 1.12em, and
> in Spec 2.0, to have 1.33em...
>
> But looks like Firefox and Safari both use 1em for it. And IE use
> something less... maybe 0.5em
>
> I wonder if there is a way to find out how the <p> is defined as a
> default value in your browser?
>
> One way might be to use javascript, but
>
> alert(document.getElementById("ha").style.margin_t op)
> alert(document.getElementById("ha").style.margin)
>
> both won't show anything. ("ha" is an ID for a <p> element)
>


You need to get the current style of the object - the .style property
only contains styles which are defined in the element's style attribute
(or have been explicitly assigned to it in script).

See http://www.quirksmode.org/dom/getstyles.html for a useful
cross-browserish method of getting the current style of an element.

Jeremy
  Réponse avec citation
 
Page generated in 0,04542 seconds with 9 queries