不幸的是,我不知道有什么优雅的解决方案,特别是当涉及到菜单项时,但弧线本身应该可以在纯 css 和几个 html 元素中实现。
也许这可以帮助您开始。
html
<div class="container">
<div class="gray"></div>
<div class="white"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.container {
height: 200px;
overflow: hidden;
position: relative;
}
.gray,
.white {
position: absolute;
left: -25%;
right: -25%;
border-radius: 100%;
}
.gray { /* use a gray border with border radius to emulate an arc */
top: -50%;
border:100px solid gray;
border-top: none;
height: 200px;
}
.white { /* put a white oval on top for the top edge of the banner */
top: -80%;
background-color: white;
height: 300px;
}
Run Code Online (Sandbox Code Playgroud)
现在的挑战是定位所有菜单项并相应地旋转它们......我并不认为这是一个可行的解决方案,但无论如何我都会发布,希望您会发现它有用。
这是我用 SVG 制作的一个版本,它是一个概念验证,需要调整才能看起来不错(由于某种原因,在 chrome 中渲染得很糟糕,在 IE 中渲染很小),但它给了你基本的想法:
svg
<svg viewBox="0 0 500 300" version="1.1">
<defs>
<!-- Start at (10,40) end at (490,40) use control point (250 ,85) -->
<path id="curvetext" d="M 10,40 Q 250,85 490,40" />
</defs>
<use x="0" y="0" xlink:href="#curvetext" fill="none" stroke="gray" stroke-width="50"/>
<text font-size="12" fill="white">
<textPath xlink:href="#curvetext">
<a xlink:href="http://example.com">Menu 1</a> Menu 2 Menu 3 Menu 4 Menu 5 Menu 6 Menu 7 Menu 8 Menu 9
</textPath>
</text>
</svg>
Run Code Online (Sandbox Code Playgroud)
SVG 演示位于: http: //jsfiddle.net/rNLsr/2/
| 归档时间: |
|
| 查看次数: |
3981 次 |
| 最近记录: |