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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#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);
}
}
</style>
</head>
<body>
<div id="sunline">
<div id="sun"></div>
<div id="earthline">
<div id="earth"></div>
<div id="moon"></div>
</div>
</div>
</body>
</html>

[css3] 看博客学习别人的旋转的星球的更多相关文章

  1. [javaSE] 看博客学习多线程的创建方式和优劣比较和PHP多线程

    通过实现Runnable接口创建线程 获取Thread对象,new出来,构造函数参数:Runnable对象 Runnable是一个接口,定义一个类MyRunnable实现Runnable接口,实现ru ...

  2. [PHP] 看博客学习观察者模式

    具体应用场景是,当subject的某个动作需要引发一系列不同对象的动作(比如你是一个班长要去通知班里的某些人),与其一个一个的手动调用触发的方法(私下里一个一个通知),不如维护一个列表(建一个群),这 ...

  3. [PHP] 看博客学习插入排序

    定义数组长度变量$len,使用count()函数,参数:数组 for循环数组,条件:从第二个开始,遍历数组,循环内 定义临时变量$temp,赋值当前元素 for循环数组,条件:遍历当前元素前面的所有元 ...

  4. [android] 看博客学习hashCode()和equals()

    equals()是Object类提供的一个方法,众所周知,每一个java类都继承自Object,所以说每一个对象都有一个equals()方法,我们在用这个方法时却一般重写这个方法 Object类中eq ...

  5. [android] 看博客学习Android常见的几种RuntimeException

    异常分为两种: 1.编译时异常 当编译时异常抛出时,需要对其进行处理声明,否则编译不通过 2.运行时异常 编译时不检测,运行时 如果抛出,程序会立刻停止 NullPointerException 空指 ...

  6. [javaSE] 看博客学习java并发编程

    共享性 多线程操作同一个数据,产生线程安全问题 新建一个类ShareData 设计一个int 型的成员变量count 设计一个成员方法addCount(),把count变量++ 在main函数中开启多 ...

  7. android fragment 博客 学习记录

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37992017 上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和 ...

  8. FPGA一个博客学习

    FPGA一个博客学习 http://bbs.ednchina.com/BLOG_PERSONALCAT_100185_2001619.HTM

  9. EF6 Code First 博客学习记录

    学习一下ef6的用法 这个学习过程时按照微软官网的流程模拟了一下 就按照下面的顺序来写吧 1.连接数据库  自动生成数据库 2.数据库迁移 3.地理位置以及同步/异步处理(空了再补) 4.完全自动迁移 ...

随机推荐

  1. 在ASP.NET Core中,静态类如何读取配置文件

    这是今天下午一个同事问我的问题,如何在静态类中读取json配置文件.我当时并没有告诉他如何如何去做,办法肯定是有,但是这种编程思维确实得改改了.静态类.静态方法不是面向对象编程的最佳实践..NET C ...

  2. 背水一战 Windows 10 (48) - 控件(集合类): FlipView

    [源码下载] 背水一战 Windows 10 (48) - 控件(集合类): FlipView 作者:webabcd 介绍背水一战 Windows 10 之 控件(集合类) FlipView 示例Fl ...

  3. SpringCloud实现集群和负载均衡

    Spring cloud是一个基于Spring Boot实现的服务治理工具包,在微服务架构中用于管理和协调服务的. 组成部分 spingcloud的五大神兽 服务发现——Netflix Eureka ...

  4. Flask系列06--(中间件)Flask的特殊装饰器 before_request,after_request, errorhandler

    一.使用 Flask中的特殊装饰器(中间件)方法常用的有三个 @app.before_request # 在请求进入视图函数之前 @app.after_request # 在请求结束视图函数之后 响应 ...

  5. [Ynoi2016]这是我自己的发明(莫队)

    话说这道题数据是不是都是链啊,我不手动扩栈就全 \(RE\)... 不过 \(A\) 了这题还是很爽的,通过昨晚到今天早上的奋斗,终于肝出了这题 其实楼上说的也差不多了,就是把区间拆掉然后莫队瞎搞 弱 ...

  6. iOS-button利用block封装按钮事件【runtime 关联】

    用block封装最常用的就是网络请求的回调,其实也可以结合category封装button的按钮事件,同时利用runtime的对象关联: UIButton+wkjButton.h 文件 #import ...

  7. 基于alpine用dockerfile创建的nginx镜像

    1.下载alpine镜像 [root@docker43 ~]# docker pull alpine Using default tag: latest Trying to pull reposito ...

  8. SQLAlchemy的ORM

    表关系: 表之间的关系存在三种:一对一.一对多.多对多.而SQLAlchemy中的ORM也可以模拟这三种关系.因为一对一其实在SQLAlchemy中底层是通过一对多的方式模拟的,所以先来看下一对多的关 ...

  9. git自己用得着的命令

    -----------随笔记记,给自己备份------------ 1.查看分支 查看当前分支:git branch 查看远程所有分支:git branch -r/git branch -a 2.切换 ...

  10. Redis随笔(六)RESP的协议规范

    1.官网文档 https://redis.io/topics/protocol http://www.redis.cn/topics/protocol.html 2.协议介绍 redis协议规范(Re ...