兔子定位问题

兔子定位问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*整体设置*/
*{
    width100%;
    padding0;
    margin:0;
}
 
/*蓝天样式*/
.sky{
    height50vh;
    background:-webkit-linear-gradient(top,rgba(196228253,10%,rgba(255255255,1100%);
    background:-moz-linear-gradient(top,rgba(196228253,10%,rgba(255255255,1100%);
    background:-o-linear-gradient(top,rgba(196228253,10%,rgba(255255255,1100%);
    background:linear-gradient(top,rgba(196228253,10%,rgba(255255255,1100%);
    positionrelative;
}
 
/*草地样式*/
.grass{
    height50vh;
    background:-webkit-linear-gradient(top,rgba(255255255,10%,rgba(14819089,1100%);
    background:-moz-linear-gradient(top,rgba(255255255,10%,rgba(14819089,1100%);
    background:-o-linear-gradient(top,rgba(255255255,10%,rgba(14819089,1100%);
    background:linear-gradient(top,rgba(255255255,10%,rgba(14819089,1100%); 
    positionrelative;
}
 
/*云朵*/
.cloud{
    width100px;
    height30px;
    border-radius: 15px;
    background: rgba(255,255,255,1);   
    position:absolute;
    top50px;
    left100%;
}
.cloud:before,.cloud:after{
    content"";
    width50px;
    height40px;
    border-radius: 50px;
    positionabsolute;
    transform:rotate(30deg);
    background: rgba(255,255,255,1);
    top-5px;
    left5px;
}
.cloud:after{
    content"";
    width60px;
    height60px;
    border-radius: 50%;
    top-25px;
    left30px;
}
 .no1{
    animation:fly 12s linear infinite;
    opacity: 0.7;
    transform:scale(1);
 }
 .no2{
    animation:fly 10s linear infinite;
    opacity: 0.7;
    transform:scale(1.2);
    top90px;
 }
 .no3{
    animation:fly 11s linear infinite;
    opacity: 0.8;
    transform:scale(0.9);
    top130px;
 }
 .no4{
    animation:fly 12s linear 2s infinite;
    opacity: 1;
    transform:scale(0.8);
    top55px;
 }
 .no5{
    animation:fly 16s linear 1s infinite;
    opacity: 0.6;
    transform:scale(0.7);
    top100px;
 }
 @keyframes fly{
    0%{
        right0px;
    }
    100%{
        left-100%;
    }
 }
 
 /*图片设置*/
 .grass img.rabbit{
    positionabsolute;
    transform:scale(0.1);
    right:200px;
    bottom50px;  
 }

想问下为什么缩放scale后兔子定位跑到了窗口上方?

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

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

5回答
大大菲锅锅哒 2017-03-10 15:51:17

我是将兔子的缩放基点位置放在右下角  兔子缩放就不会往上跑了  不知道和你的问题是不是一样

1
2
3
4
.rabbit > img{
    transform-origin: right bottom;
    transform: scale(.1);
}


小丸子爱吃菜 2017-02-13 10:31:28

给图片设置高和宽就可以了!

祝学习愉快~

  • 提问者 JERRYR00 #1
    为什么缩放就不行呢 有什么区别啊
    2017-02-13 21:51:16
  • 小丸子爱吃菜 回复 提问者 JERRYR00 #2
    可以进行缩放,同时设置宽和高,这个不冲突的~
    2017-02-14 09:18:02
提问者 JERRYR00 2017-02-11 11:45:46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>rabbit</title>
    <link rel="stylesheet" type="text/css"href="css/style.css">
</head>
<body>
    <section>
        <div class="cloud no1"></div>
        <div class="cloud no2"></div>
        <div class="cloud no3"></div>
        <div class="cloud no4"></div>
        <div class="cloud no5"></div>
    </section>
    <section>
        <img src="image/rabbit.png" class="rabbit">       
    </section>
</body>
</html>


提问者 JERRYR00 2017-02-11 11:44:00
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>rabbit</title>
    <link rel="stylesheet" type="text/css"href="css/style.css">
</head>
<body>
    <section>
        <div class="cloud no1"></div>
        <div class="cloud no2"></div>
        <div class="cloud no3"></div>
        <div class="cloud no4"></div>
        <div class="cloud no5"></div>
    </section>
    <section>
        <img src="image/rabbit.png">       
    </section>
</body>
</html>


小丸子爱吃菜 2017-02-10 09:31:43

将html代码也贴出来,我们需要运行一下查找问题,单看样式表看不出什么问题。

祝学习愉快~

  • 提问者 JERRYR00 #1
    贴出来了 请看一下是什么问题~
    2017-02-11 16:19:43
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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