V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Dive into HTML5
http://diveintohtml5.org/
octopole
V2EX  ›  HTML

纯 CSS3,实现地心旋转的效果,然而好像没有什么用吧,看着玩玩

  •  
  •   octopole · 2016-06-14 16:17:30 +08:00 · 3049 次点击
    这是一个创建于 2866 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题看着玩玩吧,复制到记事本,存成 htnl 就可以啦, ps 吐槽。。编辑预览一点也不好用,此次打脸自己。。。。。

    <html lang="en"> <head> <meta charset="UTF-8"> <title>CSS 地心旋转效果</title> <style> .box{ transform: scale(0.5); position: relative; padding: 1px; height: 300px; width: 300px; margin:100px auto; } .sunline{ position:relative; height: 400px; width: 400px; border: 2px solid black; border-radius: 50%; margin: 50px 0 0 50px; display: flex; animation: rotate 10s infinite linear; } .sun{ height: 100px; width: 100px; margin: auto; background-color: red; border-radius: 50%;

    } .earthline{ position: absolute; right: 0; top: 50%; height: 200px; width: 200px; margin: -100px -100px 0 0; border: 1px solid black; border-radius: 50%; display: flex; animation: rotate 2s infinite linear; } .earth{ margin: auto; height: 50px; width: 50px; background-color: green; border-radius: 50%; } .moon{ position: absolute; left: 0; top: 50%; height: 20px; width: 20px; margin: -10px 0 0 -10px; background-color: gray; border-radius: 50%; } @keyframes rotate{ 100%{transform:rotate(360deg);} } </style>

    </head> <body>
    </body> </html>
    9 条回复    2016-06-14 16:52:12 +08:00
    bumz
        1
    bumz  
       2016-06-14 16:25:19 +08:00
    必要的 HTML 结构在哪?
    octopole
        2
    octopole  
    OP
       2016-06-14 16:27:35 +08:00
    开头还有<!DOCTYPE html>
    然而代码我不会编辑排版啊 不知道是不是发帖子的那个排版无视原先的排版
    比如可以试试
    a
    b ( b 这里我在编辑的时候留了 2 个空格)
    octopole
        3
    octopole  
    OP
       2016-06-14 16:28:11 +08:00
    所有的原来的排版都被。。。。无视了。。。朋友可以试试。。。。
    bumz
        4
    bumz  
       2016-06-14 16:41:05 +08:00   ❤️ 1
    没有 <body> 和 </body> 之间的内容,你那些 CSS 派不上用场啊。。。
    octopole
        5
    octopole  
    OP
       2016-06-14 16:44:36 +08:00
    <body>会默认被隐藏了。。。没办法。。。怎么编辑都没用。。。都是不出现的
    octopole
        6
    octopole  
    OP
       2016-06-14 16:45:19 +08:00
    <body>
    <!-- 代码部分 begin -->
    <div class="box">
    <div class="sunline">
    <div class="sun"></div>
    <div class="earthline">
    <div class="earth"></div>
    <div class="moon"></div>
    </div>
    </div>
    </div>
    <!-- 代码部分 end -->
    </body>
    octopole
        7
    octopole  
    OP
       2016-06-14 16:45:41 +08:00
    只能留言 才有办法出现内容 但排版 依旧没用。。
    learnshare
        8
    learnshare  
       2016-06-14 16:48:00 +08:00   ❤️ 1
    用 Markdown 模式添加代码
    octopole
        9
    octopole  
    OP
       2016-06-14 16:52:12 +08:00
    soga !
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3679 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 10:26 · PVG 18:26 · LAX 03:26 · JFK 06:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.