zoukankan      html  css  js  c++  java
  • jquery学习手记(6)CSS, Styling, & Dimensions

    Css方法

    // Getting CSS properties
    $("h1").css("fontSize"); // returns a string such as "19px"
    $("h1").css("font-size"); // also works
    
    // Setting CSS properties
    $("h1").css( "fontSize", "100px" ); // setting an individual property
    
    // setting multiple properties
    $("h1").css({
      fontSize: "100px",
      color: "red"
    });

    Styling方法

    // Working with classes
    var $h1 = $("h1");
    $h1.addClass("big");
    $h1.removeClass("big");
    $h1.toggleClass("big");
    if ( $h1.hasClass("big") ) { ... }

    Dimensions

    // Basic dimensions methods
    // sets the width of all H1 elements
    $("h1").width("50px");
    // gets the width of the first H1
    $("h1").width();
    // sets the height of all H1 elements
    $("h1").height("50px");
    // gets the height of the first H1
    $("h1").height();
    // returns an object containing position
    // information for the first H1 relative to
    // its "offset (positioned) parent"
    $("h1").position();
  • 相关阅读:
    three.js 居中-模型
    three.js 打包为一个组-几个单独的模型
    ABP 菜单和权限
    set
    P2429 制杖题
    对线性筛的新理解
    P2817 宋荣子的城堡
    P2651 添加括号III
    P2858 [USACO06FEB]奶牛零食Treats for the Cows
    P1005 矩阵取数游戏
  • 原文地址:https://www.cnblogs.com/davidwang456/p/3029653.html
Copyright © 2011-2022 走看看