将复选框放在输入框下方(样式)

Placing checkbox below input box (styling)

我试图在文本输入框下方放置一个复选框,但我的 InputBar 没有占据整个父级宽度,并且复选框出现在 InputBar 的末尾。 我是前端新人,有人可以建议我可以更改什么以将复选框放在输入栏下方。

我的样式代码:

.background {
  background-image: url("../Back.jpg");
  background-repeat: no-repeat;
  margin: -11px -16px 0 -16px;
  background-size: 100%;
  min-height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.inputBar {
  padding-left: 30%;
  width: 100%;
  .enterButton {
    background: url("../arrowNext.svg") no-repeat center white;
    height: 50px;
    width: 35px;
    border-top-right-radius: 100px;
    border-bottom-right-radius: 100px;
    vertical-align: top;
  }
  .enterText {
    color: $primary-text-color-light;
    width: 60%;
    height: 50px;
    border-top-left-radius: 100px;
    border-bottom-left-radius: 100px;
    display: inline-block;
    vertical-align: top;
    padding-left: 2%;
  }
}

.check {
  display: inline-block;
  .checkBox {
    width: 40px;
    height: 20px;
    background: #555;
    margin: 5px;
    border-radius: 3px;
    padding-left: 30%;
  }
  .checkBoxText {
    font-weight: bold;
    font-size: larger;
    color: grey;
    background-color: whitesmoke;
  }
}
<div class="background">
  <div class="inputBar">
    <input class="enterText" id="inputBox" type="text" placeholder="Enter something" />
    <button class="enterButton">Enter</button>
  </div>
  <div class="check">
    <input class="checkBox" type="checkbox" defaultChecked/>
    <span class="checkBoxText">Check this</span>
  </div>
</div>

默认情况下,flex 将方向设置为 row
你可以设置flex-direction: column来实现你想要的。

.container {
  display: flex;
  flex-direction: column;
}
<div class="container">
  <div>
    <input type="text" />
    <button>Enter</button>
  </div>
  <div>
    <input type="checkbox" id="check-this" />
    <label for="check-this">Check this</label>
  </div>
</div>