用HTML与css制作八卦图

<!DOCTYPE html>

<html lang="zh">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>我的第一个页面</title>

    <style>

        body {

            background: #eee;

        }

        * {

            box-sizing: border-box;

            padding: 0;

            margin: 0;

        }

        @keyframes x {

            from {

                transform: rotate(0deg);

            }

            to {

                transform: rotate(360deg);

            }

        }

        #八卦 {

            width: 400px;

            height: 400px;

            border-radius: 50%;

            position: relative;

            overflow: hidden;

            animation: x 10s infinite linear;

            box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.75);

        }

        @media(max-width:500px) {

            #八卦 {

                width: 200px;

                height: 200px;

            }

        }

        #八卦>div:first-child {

            width: 50%;

            height: 100%;

            position: absolute;

            left: 0;

            background: black;

        }


 

        #八卦>div:nth-child(2) {

            width: 50%;

            height: 100%;

            position: absolute;

            right: 0;

            background: white;

        }

        #八卦>div:nth-child(3) {

            position: absolute;

            width: 200px;

            height: 200px;

            left: 50%;

            margin-left: -100px;

            border-radius: 50%;

            background: black;

        }

        @media(max-width:500px) {

            #八卦>div:nth-child(3) {

                width: 100px;

                height: 100px;

                margin-left: -50px;

            }

        }

        #八卦>:nth-child(4) {

            position: absolute;

            width: 200px;

            height: 200px;

            left: 50%;

            bottom: 0;

            margin-left: -100px;

            border-radius: 50%;

            background: white;

        }

        @media(max-width:500px) {

            #八卦>:nth-child(4) {

                width: 100px;

                height: 100px;

                margin-left: -50px;

            }

        }

        #八卦>:nth-child(5) {

            position: absolute;

            width: 50px;

            height: 50px;

            left: 50%;

            top: 75px;

            margin-left: -25px;

            border-radius: 50%;

            background: white;

        }

        @media(max-width:500px) {

            #八卦>:nth-child(5) {

                width: 25px;

                height: 25px;

                top: 37.5px;

                margin-left: -12.5px;

            }

        }

        #八卦>:nth-child(6) {

            position: absolute;

            width: 50px;

            height: 50px;

            left: 50%;

            bottom: 75px;

            margin-left: -25px;

            border-radius: 50%;

            background: black;

        }

        @media(max-width:500px) {

            #八卦>:nth-child(6) {

                width: 25px;

                height: 25px;

                bottom: 37.5px;

                margin-left: -12.5px;

            }

        }

        #八卦-wrapper {

            height: 100vh;

            display: flex;

            justify-content: center;

            align-items: center;

            flex-direction: column;

        }

        #八卦-描述 {

            margin-top: 1em;

        }

    </style>

</head>

<body>

    <div id="八卦-wrapper">

        <div id="八卦">

            <div></div>

            <div></div>

            <div></div>

            <div></div>

            <div></div>

            <div></div>

        </div>

        <div id="八卦-描述">

            道可道,非常道

        </div>

    </div>

</body>

</html>

浏览网址:我的第一个页面 (lyz828.github.io)icon-default.png?t=M1L8https://lyz828.github.io/htm5-css3-doem1/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值