请问已经画好了一个云朵,怎么出现五个云朵

请问已经画好了一个云朵,怎么出现五个云朵

<!DOCTYPE html>

<html>

<head>

<title>index</title>

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

</head>

<body>

<div class="bg">

<!-- 蓝天 -->

<div class="sky">

<div class="cloud one"></div>

<div class="cloud two"></div>

<div class="cloud three"></div>

<div class="cloud four"></div>

<div class="cloud five"></div>

</div>

<!-- 草地 -->

<div class="ground"></div>

</div>

</body>

</html>

---------------------------------------------------------------

    /*背景*/

    .bg{

height: 655px;

width: 100%;

position: relative;

}

.sky{

height: 60%;

width: 100%;

background:-webkit-linear-gradient(rgb(196, 228, 253),#fff);

background:   -moz-linear-gradient(rgb(196, 228, 253),#fff);

background:     -o-linear-gradient(rgb(196, 228, 253),#fff);

background:        linear-gradient(rgb(196, 228, 253),#fff);

}

.ground{

height: 40%;

width: 100%;

background:-webkit-linear-gradient(#fff,rgb(148, 190, 89));

background:   -moz-linear-gradient(#fff,rgb(148, 190, 89));

background:     -o-linear-gradient(#fff,rgb(148, 190, 89));

background:        linear-gradient(#fff,rgb(148, 190, 89));

}

/*白云*/

.cloud{

position: absolute;

background:#fff;

width: 100px;

height: 100px;

border-radius: 50%;

top: 100px;

left: 50%;

transform: translate(-50%,0);

}

.cloud:before{

background:#fff;

content:" ";

display: block;

width: 175px;

height: 50px;

position: absolute;

left: 20px;

transform: translate(-50%,0);

top: 40px;

border-radius: 25px;

}

.cloud:after{

background:#fff;

content:" ";

display: block;

width: 80px;

height: 60px;

position: absolute;

left: -10px;

transform: translate(-50%,0) rotate(65deg);

top: 33px;

border-radius: 40px 30px;

}

.cloud.one{

top: 400px;

}


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
好帮手慕言 2020-02-09 09:43:35

同学你好,可以把修改后的代码粘贴上来,老师帮助排查,祝学习愉快~

好帮手慕星星 2020-02-08 17:27:17

同学你好,cloud是每朵白云共有的样式,所以5朵元素都设置好的。定位在同一个位置就会重叠在一起了,所以看起来只有一朵白云。可以使用定位分开,例如

http://img1.sycdn.imooc.com//climg/5e3e7ee9096c325e01820235.jpg

效果

http://img1.sycdn.imooc.com//climg/5e3e7eee0928cfc603720238.jpg

自己可以再测试下。如果我的回答帮到了你,欢迎采纳,祝学习愉快~

  • 提问者 南帝1115 #1
    我加过但是没效果是怎么回事呢
    2020-02-08 20:49:33
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师