17--css() of Jquery's style operation

The css() method in jQuery actually manipulates the style attribute in the label.
Set style syntax:
css (style attribute, value of style attribute), you can set multiple style attributes in the form of method chain.
Example 1:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Jquery的css()设置样式</title>
    <script src="jquery-1.11.3.js"></script>
</head>
<body>
    <p title="你喜欢的运动" >请选择你喜欢的运动?</p>
    <ul id="sport">
        <li>足球</li>
        <li>王者荣耀</li>
        <li>乒乓球</li>
        <li>排球</li>
    </ul>
     <script>
        $(function(){
     
     
            /*css()方法底层操作的是style属性*/
            $("p").css("color","red").css("font-size","30px");
        });
     </script>
</body>
</html>

Guess you like

Origin blog.csdn.net/qwy715229258163/article/details/113878771