雪佛龙按钮

3zz*_*zzy 5 html css

我希望用CSS实现这个目标:

在此输入图像描述

这就是我所拥有的:

.breadcrumb {
  list-style: none;
  overflow: hidden;
  font: 18px Helvetica, Arial, Sans-Serif;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  float: left;
}

.breadcrumb li a {
  border: 1px solid #c00;
  color: black;
  text-decoration: none;
  padding: 10px 0 10px 55px;
  background: #fff;
  position: relative;
  display: block;
  float: left;
}

.breadcrumb li a:after {
  content: " ";
  display: block;
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  /* Go big on the size, and let overflow hide */
  border-bottom: 50px solid transparent;
  border-left: 30px solid #fff;
  position: absolute;
  top: 50%;
  margin-top: -50px;
  left: 100%;
  z-index: 2;
}

.breadcrumb li a:before {
  content: " ";
  display: block;
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  /* Go big on the size, and let overflow hide */
  border-bottom: 50px solid transparent;
  border-left: 30px solid red;
  position: absolute;
  top: 50%;
  margin-top: -50px;
  margin-left: 1px;
  left: 100%;
  z-index: 1;
}

.breadcrumb li:first-child a {
  padding-left: 10px;
}

.breadcrumb li a:hover {
  background: hsla(34, 85%, 25%, 1);
}

.breadcrumb li a:hover:after {
  border-left-color: hsla(34, 85%, 25%, 1) !important;
}

.breadcrumb li:last-child a {
  border-right: 1px solid red;
}

.breadcrumb li:last-child a:before {
  border-left: 0 solid transparent;
}
Run Code Online (Sandbox Code Playgroud)
<ul class="breadcrumb">
  <li><a href="#">Home</a></li>
  <li><a href="#">Vehicles</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

问题:

  1. 无法正确显示右侧边框
  2. 无法使最后一个元素的右边界正常(不是雪佛龙)
  3. 由于右侧边界,无法使悬停状态正确.

ank*_*tel 1

我认为这段代码很有帮助。

.breadcrumb {
  list-style: none;
  overflow: hidden;
  font: 18px Helvetica, Arial, Sans-Serif;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  float: left;
  margin-right: 10px;
}
.breadcrumb li:first-child {
  z-index: 9;
  position:relative;
}
.breadcrumb li a {
  border: 1px solid #006A9C;
  color: black;
  text-decoration: none;
  padding: 10px 10px 10px 10px;
  background: #fff;
  position: relative;
  display: block;
  float: left;
}
.breadcrumb li:first-child a:after {
  border-color:#fff;
  border-style: solid;
  border-width: 15px;
  bottom: -30px;
  box-shadow: 0 0 0 0 #c00, -1px 1px 0 1px #006A9C;
  content: "";
  height: 0;
  position: absolute;
  right: -29px;
  transform: rotate(-135deg);
  transform-origin: 0 0 0;
  width: 0;
  z-index: -1;
}

.breadcrumb li:first-child a {
  border-right: 0;
}
.breadcrumb li:last-child a {
  border-left: 0;
}
.breadcrumb li:last-child a:after{
  display:none;
}
.breadcrumb li:last-child a:before{
  border-color:#fff;
  border-style: solid;
  border-width: 15px;
  bottom: -30px;
  box-shadow: 0 0 0 0 #006A9C, -1px 1px 0 1px #006A9C;
  content: "";
  height: 0;
  position: absolute;
  left: -1px;
  transform: rotate(-135deg);
  transform-origin: 0 0 0;
  width: 0;  
}
.breadcrumb li:last-child a {
  padding-left: 28px;
}
.breadcrumb li a:hover {
  background: #006A9C;
  color: #fff;
}
.breadcrumb li a:first-child:hover::after {
  border-color:#006A9C;
}
Run Code Online (Sandbox Code Playgroud)
<ul class="breadcrumb">
  <li><a href="#">Home</a></li>
  <li><a href="#">Vehicles</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)