【发布时间】:2014-04-12 19:15:55
【问题描述】:
This is what i have got so far After after checking out tutorial
- 我想知道 div 上的弯曲效果是如何产生的
- 上图折边效果是如何产生的
CSS
#MenuShape{
height:50px;
background-color:orange;
width:200px;
position:relative;
text-align:center;
left:100px;
}
#MenuShape:after{
content:"";
position: absolute;
width: 0;
height: 0;
left:200px;
border-top: 50px solid transparent;
border-left: 100px solid orange;
border-bottom: 0px solid transparent;
}
#MenuShape:before{
content:"";
position: absolute;
width: 0;
height: -50;
left:-100px;
border-top: 50px solid transparent;
border-right: 100px solid orange;
border-bottom: 0px solid transparent;
}
HTML
<div id="MenuShape" >
sachin
</div>
https://css-tricks.com/这个网站在检查它时发现它的跨度被包裹 锚标记和 svg 标记
<a href="/" class="home">
<svg viewBox="0 0 100 25" class="shape-tab">
<use xlink:href="#shape-tab"></use>
</svg>
<span>Blog</span></a>
Click here to see the unexpected behaviour it works fine in codepen
【问题讨论】:
-
这样的事情通常是用一张图片来完成的。
-
css-tricks.com这个网站正在检查它
-
嗯,您可以清楚地看到该网站使用了一个
<svg>元素......这基本上是一个(矢量)图像。 -
其实,如果你想要那些特定的标签,它们的创建在this more recent tutorial中有详细说明。他们使用内联 SVG 图标。