例如这个图,一个透明的半圆,再扣出来一个半圆,如何实现
<div id="container">
<div id="circle"></div>
</div>
#container{
width: 200px;
height: 90px;
overflow: hidden;
}
#circle {
width: 100px;
height: 100px;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border: 40px red solid;
}
可以这样写;不用图片:纯css;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.box{position:relative;width:200px;height:200px;overflow:hidden;margin:50px auto;}
.box:after{background-color:#fff;content:'';width:200px;height:100px;position:absolute;left:0;top:100px;}
.box span{display:block;}
.a{width:200px;height:200px;background-color:red;border-radius:50% ;}
.b{position:absolute;top:25px;left:25px;width:150px;height:150px;background-color:#fff;border-radius:50%;}
</style>
</head>
<body>
<div class="box">
<span class="a"></span>
<span class="b"></span>
</div>
</body>
</html>
13 回答12.9k 阅读
7 回答2.1k 阅读
3 回答1.3k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
6 回答1.2k 阅读✓ 已解决
4 回答1.2k 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决