gpt4 book ai didi

html - 分隔 li 元素的斜 Angular 边框

转载 作者:技术小花猫 更新时间:2023-10-29 12:02:18 24 4
gpt4 key购买 nike

我想使用 li 元素创建水平导航。锂元素将被 45 度 Angular 的边界分开。我找到了这个例子:

enter image description here

这看起来不错,但是如何获得呢?

最佳答案

使用 CSS:

   li {
float: left;
background: #ccc;
margin-right: 50px;
}
li > a {
text-decoration: none;
display: block;
position: relative;
line-height: 40px;
padding: 0 8px;
color: #444;
text-shadow: 0 1px 0 #fff;
}
li > a:before {
content: '';
position: absolute;
border: 20px solid #ccc;
border-left-color: transparent;
border-top-color: transparent;
right: 100%;
top: 0;
}
li > a:after {
content: '';
position: absolute;
border: 20px solid #ccc;
border-right-color: transparent;
border-bottom-color: transparent;
left: 100%;
top: 0;
}





li:first-child > a {
background: #aaa;
}
li:first-child > a:after {
border-top-color: #aaa;
border-left-color: #aaa;
}

li:last-child > a {
background: #ddd;
}
li:last-child > a:before{
border-right-color: #ddd;
border-bottom-color: #ddd;
}
li:last-child > a:after {
border: 0;
}

这是基本的东西。您应该做一些工作才能将其用于您的目的。

See demo

See updated demo

关于html - 分隔 li 元素的斜 Angular 边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22567412/

24 4 0
文章推荐: html - 在 Bootstrap 中,如何让两行彼此下方具有不同的尺寸
文章推荐: linux - 通过环境传递的变量在脚本中不可用
文章推荐: linux - Bash-同时运行多个命令
文章推荐: html - 我如何摆脱 Firefox 中的