"justify-content: space-between" 不起作用?

"justify-content: space-between" doesn't work?

"justify-content: space-between;" 无效

#app {
  width: 300px;
  height: 40.8px;
  border: 1px solid #409EFF;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  .el-form {
    .el-form-item {
      /deep/ .el-form-item__content {
        display: flex;
        justify-content: space-between;
        .el-input {
          width: 165px;
        }
        .el-button {
          width: 115px;
        }
      }
    }
  }
 }
<div id="app">
  <el-form>
    <el-form-item>
      <el-input placeholder="请输入验证码"></el-input>
      <el-button type="primary">获取验证码</el-button>
    </el-form-item>
  </el-form>
</div>

我在 JSFiddle 提供了完整的代码。

如 iframe 所示,el-input 与 main-start 边缘不齐平,el-button 与 main-end 边缘不齐平。

为什么 "space-between" 不起作用?它就像 "space-around" 一样起作用。

问题与您从 element-ui 获得的样式有关。这个选择器应该被覆盖:

.el-form-item__content::after, .el-form-item__content::before {
    display: table;
    content: "";
}

要删除此添加:

 .el-form-item__content {
     &:before, &:after  {
        content: none !important;
     }
  }