如何将容器和标签与 Bootstrap 中的复选框对齐?

How to align container and labels with checkbox in Bootstrap?

我想实现这个。这是一个点击弹出窗口。

到目前为止,这就是我所做的。

如您所见,它占满了整个页面,我不知道为什么,也无法将标签与复选框对齐,因为标签显示在复选框下方,我无法移动它们。我真的很感激一些建议,我的想法是使用 bootstrap。我尝试阅读一些文档,但因为我刚刚开始,我真的很难理解所有内容。

CSS:

body{
    padding:0;
    margin:0;
  }
  
  .signupContainer{
    height:100%;
    position:absolute;
    overflow:hidden;
    background-color: white;
    box-shadow: 15px 9px 26px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin: 0 auto;
  }

  .box{
    position:absolute;
    height:100%;
    width:50%;
    margin-top: 55px;
    font-family: 'Poppins', sans-serif;     
    padding-bottom: 140px;
  }

  .box h1{
    text-align:center;
    margin: 0 auto;
    font-size:30px;
    margin-bottom: 20px;
  }
  
  .box input{
    font-family: 'Poppins', sans-serif;
    display:block;
    width:300px;
    margin:0px auto;
    padding:5px;
    text-align: center;
    background: #F8F8F8;
    color:#fff;
    border:0;
    border-radius: 20px;
    margin-bottom: 20px
  }
  .box input:focus,.box input:active,.box button:focus,.box button:active{
    outline:none;
  }

  .box label {
      font-family: 'Poppins', sans-serif;
  }

  .box button{
    background: #FE6047;
    border:0;
    color:#fff;
    padding:5px;
    font-size:20px;
    width:300px;
    margin:20px auto;
    display:block;
    cursor:pointer;
    border-radius: 20px;
  }
  .box button:active{
    background:#27ae60;
  }
  .box p{
    font-size:14px;
    text-align:center;
  }
  .box p span{
    cursor:pointer;
    color:#666;
  }

  input[type=checkbox] {
    margin: 2px 0 0;
    align-self: flex-start;
}

HTML:

    <div class="signupContainer col-6">
      <div class="box col-12">
        <h1 class="col">Sign up</h1>
        <input type="text"  class="col" placeholder="Usuario"/>
        <input type="email" class="col" placeholder="Email"/>
        <input type="text"  class="col" placeholder="Pais"/>
        <input type="password" class="col" placeholder="Contraseña"/>
        <input type="password" class="col" placeholder="Repite contraseña"/>
         <label for="seller" class="checkbox-inline"><input type="checkbox" id="seller" >Vendedor</label>
       <label for="buyer" class="checkbox-inline"><input type="checkbox" id="buyer" > Comprador</label>
        <button class="col">Sign</button>
      </div>
    </div>

谢谢!

试试这个:

HTML:

<div class="ContainerSignUp">
  <div class="ContainerHeaderBG"></div>
  <div class="signupContainer col-6">
    <div class="box col-12">
      <h1 class="col">Sign up</h1>
      <input type="text"  class="col" placeholder="Usuario"/>
      <input type="email" class="col" placeholder="Email"/>
      <input type="text"  class="col" placeholder="Pais"/>
      <input type="password" class="col" placeholder="Contraseña"/>
      <input type="password" class="col" placeholder="Repite contraseña"/>
      <label for="seller" class="checkbox-inline">
        <input type="checkbox" id="seller">Vendedor
      </label>
      <label for="buyer" class="checkbox-inline">
        <input type="checkbox" id="buyer">Comprador
      </label>
      <button class="col">Sign</button>
    </div>
  </div>
</div>

CSS:

body {
    padding: 0;
    margin: 0;
}

.ContainerSignUp {
  position: relative;
  background: blue;
}

.ContainerHeaderBG {
  width: 100%;
  height: 200px;
  background: green;
}

.signupContainer {
  width: 500px;
  max-width: 90%;
  top: 100px;
  left: 50%;
  transform: translateX(calc(-50% + 0.1px));
    position: absolute;
    overflow: hidden;
    background-color: white;
    box-shadow: 15px 9px 26px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin: 0 auto;
}

.box h1 {
    text-align: center;
    margin: 100px auto 0;
    font-size: 30px;
    margin-bottom: 20px;
}

.box input {
    font-family: 'Poppins', sans-serif;
    display: block;
    width: 80%;
    margin: 0px auto;
    padding: 5px 20px;
    text-align: left;
    background: #F8F8F8;
    color: #fff;
    border: 0;
    border-radius: 20px;
    margin-bottom: 20px;
  color: #000;
}

.box input:focus,
.box input:active,
.box button:focus,
.box button:active {
    outline: none;
}

.box label {
    font-family: 'Poppins', sans-serif;
  display: block;
  width: 80%;
  margin: auto;
}

.box button {
    background: #FE6047;
    border: 0;
    color: #fff;
    padding: 5px;
    font-size: 20px;
    width: 300px;
    margin: 20px auto;
    display: block;
    cursor: pointer;
    border-radius: 20px;
}

.box button:active {
    background: #27ae60;
}

.box p {
    font-size: 14px;
    text-align: center;
}

.box p span {
    cursor: pointer;
    color: #666;
}

input[type=checkbox] {
    margin: 2px 0 0;
    align-self: flex-start;
}


/* Modification */

input#seller,
input#buyer {
    display: inline;
    width: 11px;
    margin-right: 10px;
}

我在CodePen中发布的例子:
CodePen Example