老师您好,check pls .thanks a lot.

老师您好,check pls .thanks a lot.

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>2-5</title>

    <style type="text/css">

        div {

            position: absolute;

            top: 0;

            right: 0;

            bottom: 0;

            left: 0;

            box-sizing: border-box;

            width: 400px;

            height: 400px;

            margin: auto;

            border: 1px solid red;

            border-bottom: 200px solid red;

            border-radius: 50%;

            transform-origin: 50% 50%;

            animation-name: rotate;

            animation-duration: 5s;

            animation-timing-function: linear;

            animation-iteration-count: infinite;

            position: relative;

            

        }

        @keyframes rotate{

            from{ transform:rotate(0deg);}

            to{transform:rotate(360deg);}

        }

        div::before{

            content: "";

            width: 20px;

            height: 20px;

            border: 90px solid red;

            border-radius: 50%;

            background:#fff;

            position: absolute;

            top:100px;

            left:0px;

            

        }

        div::after{

            content: "";

            width: 20px;

            height: 20px;

            border: 90px solid #fff;

            

            border-radius: 50%;

            background:red;

            position: absolute;

            top:100px;

            right:0px;

            

        }

    </style>

</head>

<body>

    <div></div>

</body>

</html>



正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕慕子 2019-11-14 10:57:10

同学你好, 代码是正确,建议优化: 可以将伪元素相同的代码提取出来,简化代码书写

http://img1.sycdn.imooc.com//climg/5dccc2710945773c07460826.jpg

如果帮助到了你, 欢迎采纳,祝学习愉快~~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师