最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

[css3]看博客学习别人的旋转的星球_html/css

来源:动视网 责编:小采 时间:2020-11-27 16:26:18
文档

[css3]看博客学习别人的旋转的星球_html/css

[css3]看博客学习别人的旋转的星球_html/css_WEB-ITnose:定义一个div 太阳轨道sunline,边框显示出来,定义position为relative #sunline{ width: 500px; height: 500px; border:2px solid #000; border-radius: 50%; margin:50px auto; position: relativ
推荐度:
导读[css3]看博客学习别人的旋转的星球_html/css_WEB-ITnose:定义一个div 太阳轨道sunline,边框显示出来,定义position为relative #sunline{ width: 500px; height: 500px; border:2px solid #000; border-radius: 50%; margin:50px auto; position: relativ


定义一个div 太阳轨道sunline,边框显示出来,定义position为relative

#sunline{

width: 500px;

height: 500px;

border:2px solid #000;

border-radius: 50%;

margin:50px auto;

position: relative;

animation:sunRotate 5s;

}

定义一个div 太阳sun,把红太阳放在中间,居中显示,定义position为absolute,

距左50%,剧上50%,左边距负的宽度的一半,上边距负的高度的一半

#sun{

background: red;

width: 150px;

height: 150px;

position: absolute;

left: 50%;

top:50%;

margin-left:-75px;

margin-top: -75px;

border-radius: 50%;

}

定义一个地球的轨道 earthline,边框显示出来,定义position为absolute,距左50%,剧上负的高度一半,左边距负的宽度的一半

#earthline{

width: 200px;

height: 200px;

border:1px solid #000;

border-radius: 50%;

position: absolute;

left: 50%;

top: -100px;

margin-left: -100px;

}

定义一个div 地球 earth,把地球放在水平居中,太阳轨道垂直地球居中,定义position为absolute,距左50%,剧上50%,左边距负的宽度的一半,上边距负的高度的一半

#earth{

background: green;

width: 100px;

height: 100px;

border-radius: 50%;

position: absolute;

left: 50%;

margin-left: -50px;

top: 50%;

margin-top: -50px;

}

定义一个月球moon,定义position为absolute,距左50%,剧上负的高度一半,左边距负的宽度的一半

#moon{

width: 40px;

height: 40px;

background: blue;

border-radius: 50%;

position: absolute;

left: 50%;

margin-left: -20px;

top: -20px;

}

定义动画@keyframes,100%的进度的时候,旋转一圈

@keyframes sunRotate{

100%{

transform:rotate(360deg);

}

}

为太阳轨道sunline绑定动画,使用属性animation,参数:规则名称,执行时间,速度曲线,延迟时间,播放次数,是否反向

animation:sunRotate 10s linear 0s infinite;

速度曲线: linear(线性匀速) ease(缓动)

播放次数:infinite(无限次数)

为地球轨道earthline绑定动画

animation:sunRotate 5s linear 0s infinite; 运行时间不一样,这个快

 

文档

[css3]看博客学习别人的旋转的星球_html/css

[css3]看博客学习别人的旋转的星球_html/css_WEB-ITnose:定义一个div 太阳轨道sunline,边框显示出来,定义position为relative #sunline{ width: 500px; height: 500px; border:2px solid #000; border-radius: 50%; margin:50px auto; position: relativ
推荐度:
标签: 旋转 博客 //
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top