如何减去带边距的 div 的百分比,使它们完全适合它们的父级?

How to substract the percentage of divs with margins so they perfectly fit their parent?

有了这个HTML/CSS:

HTML:

  <div class="row">
    <div class="col-6">
    </div>
    <div class="col-6">
    </div>
  </div>

CSS/STYLUS:

.row {
  max-width: 1230px
  margin: 0 auto
  width: 100%
}

.col-6 {
  margin: 5px
  float: left
  width: 50% - 10px
}

我希望 .col-6 div 完全适合它们的父级 .row。但是我错了:

使 .col-6 div 完全适合 .row(水平)的正确方法是什么?

尝试使用 calc();

width: calc(50% - 10px);