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

    Introduction to the use of jquery css_jquery

    WBOY
    Release: 2016-05-16 17:36:22
    Original
    1070 people have browsed it

    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");
    Copy after login

    〈2〉Set CSS properties

    css("propertyname","value");
    Copy after login

    〈2.1〉Set multiple CSS properties

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

    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;
      Copy after login
    • 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).
    Related labels:
    source:php.cn
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template