首页 > Web开发 > 详细

HTML+CSS编写五环居中案例

时间:2019-08-29 14:49:28      阅读:55      评论:0      收藏:0      [点我收藏+]

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="css.css">
    <title>Document</title>
</head>

<body>
    <div class="plat">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
        <div class="circle5"></div>
    </div>
</body>

</html>

 

css代码如下

* {
    margin: 0;
    padding: 0;
}

.plat {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -190px;
    margin-top: -93px;
    height: 186px;
    width: 380px;
}

.circle1,
.circle2,
.circle3,
.circle4,
.circle5 {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 10px solid red;
    border-radius: 50%;
}

.circle1 {
    border-color: red;
    left: 0;
    top: 0;
}

.circle2 {
    border-color: green;
    left: 130px;
    top: 0px;
    z-index: 3;
}

.circle3 {
    border-color: yellow;
    left: 260px;
    top: 0px;
}

.circle4 {
    border-color: olive;
    left: 65px;
    top: 65px;
}

.circle5 {
    border-color: pink;
    left: 195px;
    top: 65px;
}

结果显示如下:

技术分享图片

 

 

参考自腾讯课堂!

 

谢谢

 

HTML+CSS编写五环居中案例

原文:https://www.cnblogs.com/zhzhang/p/11429455.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!