HTML+CSS编写五环居中案例

匿名 (未验证) 提交于 2019-12-02 20:32:16

<!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; }

结果显示如下:

参考自腾讯课堂!

лл

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!