为了账号安全,请及时绑定邮箱和手机立即绑定

我这段代码为什么不显示


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title>操作元素样式</title>

        <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>

        <link href="style.css" rel="stylesheet" type="text/css" />

    </head>

    

    <body>

        <h3>css()方法设置元素样式</h3>

        <div id="content">我穿了一件红色外衣</div>

        

        <script type="text/javascript">

            $("#content").addClass("blue white");

        </script>

    </body>

</html>


正在回答

2 回答

你需要先增加一个blue和white的css样式,可以在这个代码中增加:

<style type="text/css">

.red{background-color: red;}
.white{color:white;}

</style>   或者是再旁边那个style.css里面增加

.red{background-color: red;}
.white{color:white;}

0 回复 有任何疑惑可以回复我~
#1

麦兜菠萝油王子 提问者

非常感谢!
2016-05-10 回复 有任何疑惑可以回复我~

blue white这两个class在哪呢?我怎么没看到?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
jQuery基础课程
  • 参与学习       154722    人
  • 解答问题       7289    个

加入课程学习,有效提高前端开发速度

进入课程

我这段代码为什么不显示

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号