• Home  >  Article  >  Web Front-end  >  Introduction to the use of jquery css_jquery

    Introduction to the use of jquery css_jquery

    WBOY
    WBOYOriginal
    2016-05-16 17:36:221059browse

    jQuery operates CSS

    • addClass() - Add one or more classes to the selected element
    • removeClass() - removes one or more classes from selected elements
    • toggleClass() - Add/remove classes to the selected element.
    • css() - Sets or returns one or more style attributes of the selected element.

    jQuery css() method

    〈1〉Return CSS properties

    css("propertyname");

    〈2〉Set CSS properties

    css("propertyname","value");

    〈2.1〉Set multiple CSS properties

    css({"propertyname":"value","propertyname":"value",...});

    jQuery size method

    jQuery provides several important methods for handling dimensions:

    • width() Sets or returns the width of an element (not including padding, borders, or margins).
    • height() Sets or returns the height of an element (not including padding, border, or margins).
      设置:$("#div1").width(500).height(500); more : $(window/document).width/height;
    • innerWidth() Returns the width of the element (including padding).
    • innerHeight() Returns the height of the element (including padding).
    • outerWidth() Returns the width of the element (including padding, border and margin).
    • outerHeight() Returns the height of the element (including padding, border and margin).
    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn