有没有办法用 CSS 为箭头形状添加边框?

Is there a way to add a border to an arrow shape with CSS?

我只用 CSS 创建了一个类似箭头的形状。我想给它加一个边框,如果可能的话,也加一个框阴影。我试过关注 ,但没用。我也想知道是否有办法让左边的白色三角形(给箭头形状的三角形)透明而不是白色。

这就是我想要实现的目标:

这就是我的。如您所见,我只缺少边框和阴影:

.box {
  width: 180px;
  height: 30px;
  background: -webkit-linear-gradient(-211.23000000000002deg, #B07537 0, #F0B971 100%);
  background: -moz-linear-gradient(301.23deg, #B07537 0, #F0B971 100%);
  background: linear-gradient(301.23deg, #B07537 0, #F0B971 100%);
  text-align: center;
  color: #fff;
  position: absolute;
  display: table;
  z-index: 1;
  top: 20px;
  right: 7px;
  filter: drop-shadow(0px 3px 4px rgba(0, 0, 0, 0.25));
}

.box span {
  display: table-cell;
  vertical-align: middle;
  font-size: 1em;
  font-weight: 500;
}

.box:before {
  content: '';
  position: absolute;
  border-left: 15px solid white;
  border-top: 15px solid transparent;
  border-bottom: 17px solid transparent;
  left: 0px;
  top: 0px;
  width: 0;
  height: 0;
  display: block;
}
<div class="box">
  <span>Text</span>
</div>

这是我用纯 css 所能达到的最接近的结果。我希望它至少能对你有所帮助。让我知道它确实如此。

.box{
  font-size:20px;
  position:relative;
  display:inline-block;
  margin:5em;
  text-align:center;
  filter: drop-shadow(0px 3px 4px rgba(0, 0, 0, 0.5));
}

.arrow {
  height: 30px;
  display:inline;
  position:relative;
}

.content{
  display:inline-block;
  padding: 0.7em 1em 0.5em;
  min-width: 10em;
  background: linear-gradient(270deg, #B07537 0, #F0B971 100%);
  position:relative;
  color: white;
  font-weight: 500;
}

.box:before,
.box:after,
.arrow:before,
.arrow:after {
  content:'';
  position:absolute;
  border-style:solid;
}

.arrow:before {
  top: -0.2em;
  bottom: 0;
  left:-1.85em;
  margin: auto;
  border-width: 1.4em 1em 1.4em 1.15em;
  border-color: #fccc4f #fccc4f #fccc4f transparent;
  z-index:-1;
}

.arrow:after {
  left:-1.5em;
  margin: auto;
  border-width: 1.2em 1em 1.2em 1em;
  border-color: #F0B971 #F0B971 #F0B971 transparent ;
  z-index:-1;
}

.box:before{
  top: -0.15em;
  bottom: -0.15em;
  left:0;
  right: 0;
  margin: auto;
  border-width: 1.4em 1em 1.4em 1.15em;
  border-color: #fccc4f #fccc4f #fccc4f transparent;
  z-index:-1;
}

.box:after{
  bottom: -.6em; 
  right:0;
  border-width: 0 0 .4em .7em;
  border-color:  gray transparent transparent gray ;
}

.text {
  margin-left: -2em;
  line-height: 1;
  letter-spacing: 2px;
  font-weight: bold;
}

/* .text:before{
  top:100%; left:0;
  border-width: .5em 2em 0 0;
  border-color: #FC9544 transparent transparent transparent;
} */
<div class="box">
  <div class="arrow"></div>
  <div class="content">
    <span class="text">Text</span>
    </div>
</div>