$("#container").css("left")
should return the left positioning of an element. If the css for the element says left: 20px;
the jQuery should return 20px
. What should happen for an element that is positioned relative, but not given a CSS left
position?
I've noticed that Chrome and Firefox handle this differently. Firefox returns 0px
, Chrome returns auto
. Here's a JSFiddle to provide a demo of the behaviour. Please view it in Firefox and Chrome.
Is this expected behaviour? To me it looks like Chrome and FF give the element a different default position (0px
/auto
). Is there a standard that applies in this case, that one of the browsers is violating, and if so, which one is correct?
In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery. A (selector) to "query (or find)" HTML elements.
Description. "$("div p")" Selects all elements matched by <div> that contain an element matched by <p>.
<p>This is a paragraph selected by a jQuery method. </p> <p>This is also a paragraph selected by a jQuery method. </p> $("p").
$ is a short form of jQuery function. $() = jQuery() = window. $() = window. jQuery() $()/jQuery() is a selector function that selects DOM elements.
The default for left is "auto"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With