200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > [css3] 看博客学习别人的旋转的星球【HTML】

[css3] 看博客学习别人的旋转的星球【HTML】

时间:2021-11-20 12:14:03

相关推荐

[css3] 看博客学习别人的旋转的星球【HTML】

web前端|html教程

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

web前端-html教程

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

rand 源码,Ubuntu安装jq命令,如何添加多个tomcat,网页爬虫入门,php开发驻场费用,抖音seo关键词指数在哪里看lzw

#sunline{

吾爱源码论坛,vscode触发建议,ubuntu接两台主机,后台打开tomcat,sqlite怎样插入数据,织梦5.7视频插件,如何入门前端框架,爬虫最多判几年,卫神php,卡特seo,在线直播源码-直播网站源码,winform 网页 例子,phpmps模板语法,祝福信息小程序源码lzw

width: 500px;

供货商网站源码,ubuntu软件库配置,tomcat9百度云,公司爬虫的框架,php和vue架构是什么架构,seo定位精准lzw

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; 运行时间不一样,这个快

#sunline{ width: 500px; height: 500px; border:2px solid #000; border-radius: 50%; margin:100px auto; position: relative; animation:sunRotate 10s linear 0s infinite;}#sun{ background: red; width: 150px; height: 150px; position: absolute; left: 50%; top:50%; margin-left:-75px; margin-top: -75px; border-radius: 50%;}#earthline{ width: 200px; height: 200px; border:1px solid #000; border-radius: 50%; position: absolute; left: 50%; top: -100px; margin-left: -100px; animation:sunRotate 5s linear 0s infinite;}#earth{ background: green; width: 100px; height: 100px; border-radius: 50%; position: absolute; left: 50%; margin-left: -50px; top: 50%; margin-top: -50px;}#moon{ width: 40px; height: 40px; background: blue; border-radius: 50%; position: absolute; left: 50%; margin-left: -20px; top: -20px;}@keyframes sunRotate{ 100%{ transform:rotate(360deg); }}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。