【发布时间】:2015-05-01 22:41:32
【问题描述】:
我正在尝试在 css 中创建这个形状。
我已尽我所能,但无法在右侧创建尖峰
这是我的 CSS
nav li a {
float: left;
height: 23px;
line-height: 24px;
position: relative;
padding: 1px 10px 0 24px;
color: #fff;
background-color: #393233;
text-align: center;
width:75%;
}
nav li a:before {
content: "";
float: left;
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
border-color: white #393233 white white;
border-style: solid;
border-width: 12px 12px 12px 12px;
}
nav li a:after {
content: "";
float: left;
position: absolute;
top: 0;
right: -12px;
width: 0;
height: 0;
border-color: #393233 transparent #393233 #393233;
border-style: solid;
border-width: 12px 12px 12px 12px;
}
我创建了一个 jsfiddle 来表达我的代码。
非常感谢任何帮助
【问题讨论】:
-
你需要添加另一个 DOM 元素来制作我所看到的最终三角形。
标签: html css css-shapes