简体   繁体   English

CSS样式导航元素

[英]CSS styling nav elements

I have been trying to recreate this menu for some time now only I have had little success. 我一直在尝试重新创建此菜单已有一段时间了,但仅获得了很少的成功。 I am not inexperienced with CSS however this problem has left me stumped. 我对CSS并不陌生,但是这个问题使我感到困惑。 I tried inspecting the page only I can't seem to find the secret to creating the "wavy" corners of each link. 我尝试检查页面只是似乎找不到找到每个链接的“波浪形”角的秘密。 Any help you can give is much appreciated. 您能提供的任何帮助将不胜感激。 Here is a link to the site: 这是该站点的链接:

http://css-tricks.com http://css-tricks.com

Thanks in advance, and good luck! 在此先感谢您,祝您好运!

在此处输入图片说明 CSS-TRICKS is using an inline SVG for each tab, the color is set using CSS. CSS-TRICKS为每个选项卡使用嵌入式SVG,颜色是使用CSS设置的。

Here is a good introduction by Chris himself: http://css-tricks.com/using-svg/ 以下是克里斯本人的精彩介绍: http : //css-tricks.com/using-svg/

Here is a more detailed description: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Fills_and_Strokes 这是更详细的描述: https : //developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Fills_and_Strokes

他在这里使用SVG,如果将其展开,则可以看到根代码<path id="shape-tab" d="M100,25C79.568,25,84.815,0,59.692,0H11.149C5.027,0,0,4.634,0,10.385V25"></path>

您总是可以尝试在css-tricks上找到的教程,以及http://css-tricks.com/tabs-with-round-out-borders/

Chris has used svgs to attain those shapes. 克里斯使用svg来获得这些形状。

You could also use background images to achieve the same layout. 您也可以使用背景图像来实现相同的布局。 Create a sprite containing the images for the first menu-item image and the subsequent menu-item image. 创建一个精灵,其中包含第一个菜单项图像和后续菜单项图像的图像。 Make the menu items position: relative and provide them with a z-index values to overlap on each menu item. 将菜单项position: relative并为其提供z-index值以在每个菜单项上重叠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM