jQuery.css() - marginLeft vs. margin-left?

前端 未结 6 1898
感动是毒
感动是毒 2020-12-02 22:22

With jQuery.css() I\'ve been told I can use the following two functions for the same results:

$(\".element\").css(\"marginLeft\") = \"200px\";

$(\".element\         


        
6条回答
  •  时光取名叫无心
    2020-12-02 22:59

    jQuery is simply supporting the way CSS is written.

    Also, it ensures that no matter how a browser returns a value, it will be understood

    jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both .css('background-color') and .css('backgroundColor').

提交回复
热议问题