css奥运五环

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>css奥运五环</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
.img_cankao{
width:400px;
}

.fiveRings{
position:relative;
display:inline-block;
width:500px;
}
.fiveRings div{
position:absolute;
width:30%;
height:0;
padding-bottom:calc(30% - 20px);
border-width:10px;
border-width:10px;
border-style:solid;
border-radius:100%;
box-sizing:border-box;
}
.fiveRings .blue{
border-color:blue;
}
.fiveRings .black{
left:50%;
margin-left:-15%;
border-color:black;
}
.fiveRings .red{
right:0;
border-color:red;
}
.fiveRings .yellow{
transform:translateY(50%);
left:17.5%;
border-color:yellow;
}
.fiveRings .green{
transform:translateY(50%);
right:17.5%;
border-color:green;
}
.fiveRings .yellow:before,.fiveRings .yellow:after,.fiveRings .green:before,.fiveRings .green:after{
content:"";
border-width:10px;
border-style:solid;
border-color:transparent transparent transparent transparent;
width:100%;
height:100%;
position:absolute;
top:-10px;
border-radius: 100%;
left:-10px;
}
.fiveRings .yellow:before{
transform: translateY(-50%);
left:-75%;
border-color:transparent blue transparent transparent;
}
.fiveRings .yellow:after{
transform: translateY(-50%);
left: 60%;
border-color: transparent transparent black transparent;
}
.fiveRings .green:before{
transform: translateY(-50%);
left: -75%;
border-color: transparent black transparent transparent;
}
.fiveRings .green:after{
transform: translateY(-50%);
left: 60%;
border-color: transparent transparent red transparent;
}
</style>
</head>
<body>
<img class="img_cankao" alt="" src="../参考图片/img4.png"/>

<div class="fiveRings">
<div class="blue"></div>
<div class="black"></div>
<div class="red"></div>
<div class="yellow"></div>
<div class="green"></div>
</div>
</body>
</html>

posted @ 2018-10-09 16:35  heart—flying  阅读(585)  评论(0编辑  收藏  举报