html5(h5)和css3(c3)绘制的太阳系


<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title></title>
  <style>
    body{
      background-color: #000;
      overflow: hidden;
    }

    .sun{
      width: 100px;
      height: 100px;
      position: absolute;
      left:50%;
      top:50%;
      transform:translate(-50%,-50%);
      background-color: yellow;
      border-radius: 50%;
      box-shadow: 0px 0px 20px 0px red;
    }

    .earth{
      width: 300px;
      height: 300px;
      position: absolute;
      left:50%;
      top:50%;
      transform:translate(-50%,-50%);
      border:1px solid #ccc;
      border-radius: 50%;

      /*调用动画*/
      animation: rot 5s linear infinite;
    }

    .earth::before{
      content:"";
      width:50px;
      height: 50px;
      position: absolute;
      top:50%;
      transform:translate(-50%,-50%);
      background-color: dodgerblue;
      border-radius: 50%;
    }

    .mars{
      width: 450px;
      height: 450px;
      position: absolute;
      left:50%;
      top:50%;
      transform:translate(-50%,-50%);
      border:1px solid #ccc;
      border-radius: 50%;

      /*调用动画*/
      animation: rot 8s linear infinite;
    }

    .mars::before{
      content:"";
      width:30px;
      height: 30px;
      position: absolute;
      top:50%;
      transform:translate(-50%,-50%);
      background-color: gold;
      border-radius: 50%;
    }

    .venus{
      width: 550px;
      height: 550px;
      position: absolute;
      left:50%;
      top:50%;
      transform:translate(-50%,-50%);
      border:1px solid #ccc;
      border-radius: 50%;

      /*调用动画*/
      animation: rot 10s linear infinite;
    }

    .venus::before{
      content:"";
      width:60px;
      height: 60px;
      position: absolute;
      top:50%;
      transform:translate(-50%,-50%);
      background-color: hotpink;
      border-radius: 50%;
    }


    .moon{
      width: 70px;
      height: 70px;
      position: absolute;
      top:50%;
      transform:translate(-50%,-50%);
      /*border:1px solid #ccc;*/
      border-radius: 50%;
      animation: rot 2s linear infinite;
    }

    .moon::before{
      content:"";
      width:10px;
      height: 10px;
      position: absolute;
      top:50%;
      transform:translate(-50%,-50%);
      background-color: #fff;
      border-radius: 50%;
    }

    @keyframes rot {
      0%{
        transform:translate(-50%,-50%) rotate(0deg) ;
      }

      100%{
        transform:translate(-50%,-50%) rotate(360deg) ;
      }
    }
  </style>
</head>
<body>
  <div class="sun"></div>
  <div class="earth">
    <div class="moon"></div>
  </div>
  <!-- 火星-->
  <div class="mars"></div>
  <!-- 金星-->
  <div class="venus"></div>
</body>
</html>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
下面是一个用HTML5CSS3实现的带样式的三级导航: ```html <!DOCTYPE html> <html> <head> <title>三级导航</title> <style> nav ul { list-style: none; margin: 0; padding: 0; background-color: #333; } nav li { display: inline-block; position: relative; line-height: 50px; padding: 0 10px; } nav a { display: block; color: #fff; text-decoration: none; padding: 0 10px; border-right: 1px solid #fff; } nav ul ul { display: none; position: absolute; top: 50px; left: 0; background-color: #333; padding: 0; } nav ul ul li { display: block; width: 100%; } nav ul ul a { display: block; padding: 10px; border-bottom: 1px solid #fff; } nav ul li:hover > ul { display: block; } nav ul ul ul { display: none; position: absolute; top: 0; left: 100%; background-color: #333; padding: 0; } nav ul ul ul li { display: block; width: 100%; } nav ul ul ul a { display: block; padding: 10px; border-bottom: 1px solid #fff; } </style> </head> <body> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a> <ul> <li><a href="#">Overview</a></li> <li><a href="#">Team</a></li> <li><a href="#">History</a> <ul> <li><a href="#">2020</a></li> <li><a href="#">2019</a></li> <li><a href="#">2018</a></li> </ul> </li> </ul> </li> <li><a href="#">Services</a> <ul> <li><a href="#">Web Design</a></li> <li><a href="#">SEO</a></li> <li><a href="#">Hosting</a></li> </ul> </li> <li><a href="#">Contact</a></li> </ul> </nav> </body> </html> ``` 在这个例子中,我们使用了`<nav>`元素来定义导航,使用`<ul>`和`<li>`元素来创建列表,使用CSS3的`position`属性和伪类选择器来控制菜单的显示和隐藏,使用`background-color`属性来设置背景颜色,使用`padding`属性来调整内容的间距,使用`border`属性来添加边框,使用`color`属性来设置文字颜色,使用`text-decoration`属性来取消链接的下划线等等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ITzhongzi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值