ste*_*eai 4 html css shapes css3 css-shapes
以下是我希望它的外观:

我意识到这是一个丑陋的模型,显然当我真正做到这一点时,比例看起来会更好,但我想知道如何用CSS做这件事.
小提琴在这里http://jsfiddle.net/bU3QS/1/
<div class="header">
</div>
.header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: #000;
z-index: 10000;
height: 110px;
overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)
使用:after伪元素:
.header:after {
content: '';
position: absolute;
background: black;
width: 50px;
height: 50px;
z-index: 1;
border-radius: 50%; /* Makes the element circular */
bottom: -25px;
left: 50%;
margin-left: -25px;
}
Run Code Online (Sandbox Code Playgroud)
对于此解决方案,overflow: hidden;已从.headerCSS中删除.
这是一个小提琴:http://jsfiddle.net/t97AX/
这是另一种方法,它不依赖于半圆的宽度来正确地居中:
.header:after {
content: '';
position: relative;
top: 100%;
display: block;
margin: 0 auto;
background: red;
width: 50px;
height: 25px;
border-radius: 0 0 50px 50px;
}
Run Code Online (Sandbox Code Playgroud)
小提琴(为了清晰起见,半圆形红色):http://jsfiddle.net/x4mdC/
更多内容:before和:after:http://www.w3.org/TR/CSS2/selector.html#before-and-after