Here's some more info:
http://www.w3.org/TR/CSS21/box.html#propdef-margin
> The 'margin' property is a shorthand property for setting 'margin-top',
> 'margin-right', 'margin-bottom', and 'margin-left' at the same place in the
> style sheet.
(emphasis mine)
on the same page, the inital value is defined as 0 for each of the top,
right, bottom, and left. For margin's initial property, it says "see
individual properties".
It is interesting that you can set each of the t,r,b,l and margin will
return undefined. If you ever set margin, margin will return values from
there on. Would it be consistent with jQuery's philosophy to normalize this
and have it work as a getter from the start, or is this 'undefined' behavior
useful/correct?
- Richard
On 9/21/07, Richard D. Worth <[EMAIL PROTECTED]> wrote:
>
> I don't have an answer, but I see the same is true for margin.
>
> // tested in FF w/ firebug
> $("#someElement").css("margin-left") // "0px"
> $("#someElement").css("margin") // "undefined"
> $("#someElement").css("margin", 0).css("margin") // "0pt 0pt 0pt 0pt"
>
> Is jQuery simply returning what the browser returns? Is this consistent
> across browsers?
>
> Here's a related thread, talking about the same with border-color:
>
> .css("border-color") returning undefined
> http://groups.google.com/group/jquery-en/browse_thread/thread/9fdb1c44c2d9083f
>
>
> - Richard
>
> On 9/21/07, Piotr Sarnacki <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > I'm playing around with css manipulation and I encountered strange
> > problem. jQuery("#someElement").css("background") (or background-
> > position) returns undefined, no matter if background-position is set
> > or not :]
> >
> > background-image, background-color work fine :)
> >
> > Peter
> >
> >
>