删除箭头的背景色

时间:2019-05-02 10:06:20

标签: css css3

我有以下CSS代码可在我的下拉菜单中添加一个箭头:

div {
 &.toggle-assessment-key-dropdown {
   margin-top: 10px;
   border: 1px solid #cdd1da;
   min-width: 180px;
   border-radius: 4px;
   min-height: auto;
   padding: 6px 10px 5px 9px;
   background: #ffffff;
   position: absolute;
   top: 24px;
   left: 0;
   z-index: 501;

   &:after {
     content: '';
      position: absolute;
      bottom: 100%;
      left: 27%;
      margin-left: 8px;
      width: 0;
      height: 0;
      border-bottom: 6px solid #cdd1da;
      border-right: 6px solid transparent;
      border-left: 6px solid transparent;
      border-color: transparent transparent #fff transparent;
      border-width: 6px;
      background: #cdd1da;
    }
  }
}

这是结果:

image

我想删除灰色角但保留灰色边框:

谢谢

1 个答案:

答案 0 :(得分:2)

我已根据要求创建了代码段,目前已使用CSS完成,您可以制作CSS,否则我将创建一支笔让我知道。请检查:

div.toggle-assessment-key-dropdown {
  margin-top: 10px;
  border: 1px solid #cdd1da;
  min-width: 180px;
  border-radius: 4px;
  min-height: auto;
  padding: 6px 10px 5px 9px;
  background: #ffffff;
  position: absolute;
  top: 24px;
  left: 0;
  z-index: 501;
}
  div:before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 26%;
    margin-left: 8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-color: transparent transparent #cdd1da transparent;
    border-width: 7px;
    
  }
  div:after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 27%;
    margin-left: 8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
    border-width: 5px;
    
  }
<div class="toggle-assessment-key-dropdown">
Item
</div>