老师 我这个class怎么不起作用?

来源:3-4 自由编程

慕尼黑4757019

2019-04-11 23:08:05

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>

<style>

.box{

width: 200px;

height: 200px;

background: pink;

}

.grenn{

background: green;

}

</style>

</head>

<body>

<div class="btn">点击这里!</div>

<div class="box">


</div>

<script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>

<script>

$('.btn').click(function(){

$('.box').wrapInner($('<div class="green"><p>我是</p><p>smallBox内容</p></div>'));

})

</script>

</body>

</html>


写回答

1回答

好帮手慕糖

2019-04-12

同学你好,是指添加的绿色这个样式选择器不生效吗?这是因为单词拼写错误哦,css中的与js中的类名不一致,例:

http://img.mukewang.com/climg/5cafefea0001d9b707840621.jpg

希望能帮助到你,祝学习愉快!

0

0 学习 · 3299 问题

查看课程