样式操作(css方法)

2018-04-26  本文已影响0人  琪33
 <script src="jquery-1.11.1.js"></script>
    <script>
        $(function () {

            //样式操作方法1(建值对的写法):  css(json);
//            $("div").css({"width":100,"height":100,"background-color":"pink"});

            //样式操作方法2(链式编程):  css(属性,值);
            $("div").css("background-color","red").css("width",100px,");

            //样式操作方法3:  
             $("div").css("background-color","red");
             $("div").css("width",100px,");
        })
    </script>
</head>
<body>
<div></div>
<div style="width: 200px;height:300px;background: yellow"></div>
<div style="width: 200px;height:300px;background: yellow"></div>
<div style="width: 200px;height:300px;background: yellow"></div>
</body>
上一篇 下一篇

猜你喜欢

热点阅读