添加 justify-content:space-around 时在 li 之前空 space

empty space before li when adding justify-content:space-around

我正在尝试使用 ul/li 元素制作一个标签,我使用了 justify-content: space-around,所以当然它在元素之间添加了 space,但是我无法设置 li 的样式,例如当我添加边框时,边框是添加到元素上而不是 space,所以你知道如何解决这个问题吗?

这是工作片段

ul.tab1 {
    /* reset unordered list to not use default list styles */
    padding: 0;
    margin: 0;
    list-style:none;
    /* add display flex with space around and vertical centering...also stop wrap */
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
    border: 1px solid #8A4DEE;
    border-bottom: none;
    border-top-left-radius: 12px 12px;
    border-top-right-radius: 12px 12px;
    background-image: linear-gradient(to right, #F9F9F9 , #DDCDFD);
  }

  ul.tab1 li::before {
    padding: 0;
    margin: 0;
    content: none;
  }
  ul.tab1 li a {
    height: 51px;
    color: #8A4DEE;
    border-right: 1px solid #8A4DEE;
    border-bottom: 1px solid #8A4DEE;
    display: table-cell;
    vertical-align: middle;
    padding-right: 30px;
  }
  ul.tab1 li:first-child a {
    padding-left:20px;
  }
  ul.tab1 li:last-child a {
    padding-right:10px;
  }
  ul.tab1 li a.active {
      border-bottom: none;
  }
<ul class="tab1">
    <li><a href="#" class="tablinks active">aaaa</a></li>
    <li><a href="#" class="tablinks">bbbb</a></li>
    <li><a href="#" class="tablinks">cccc</a></li>
    <li><a href="#" class="tablinks">dddd</a></li>
                                                                
                                                                
                                                                
                                                            </ul>

你在找这样的东西吗

ul {
      padding: 0;
    margin: 0;
}
ul.tab1 {
    /* reset unordered list to not use default list styles */
    list-style:none;
    /* add display flex with space around and vertical centering...also stop wrap */
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
    border: 1px solid #8A4DEE;
    border-bottom: none;
    border-top-left-radius: 12px 12px;
    border-top-right-radius: 12px 12px;
    background-image: linear-gradient(to right, #F9F9F9 , #DDCDFD);
  }

  ul.tab1 li::before {
    padding: 0;
    margin: 0;
    content: none;
  }
  ul.tab1 li a {
    color: #8A4DEE;
  }
li {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 51px;
  width: 100%;
}
  ul.tab1 li {
    color: #8A4DEE;
    border-right: 1px solid #8A4DEE;
  }
  ul.tab1 li a.active {
      border-bottom: none;
  }
  ul li:last-child {
    border-right: none;
  }
<ul class="tab1">
    <li><a href="#" class="tablinks active">aaaa</a></li>
    <li><a href="#" class="tablinks">bbbb</a></li>
    <li><a href="#" class="tablinks">cccc</a></li>
    <li><a href="#" class="tablinks">dddd</a></li>
    </ul>