如何将input =“ radio”与其标签对齐?

Ann*_*rie 5 html css html5 vertical-alignment

我知道这里有很多答案。我搜寻了一下,试图适应,但一直失败,这就是为什么我现在要问。

我有以下问题。我希望标签和输入都在同一行中:是o否o(o表示输入)。

在下面的代码中,请注意我将label的display属性更改为inline block:

<div class="col-sm-3">
        <label>Yes</label>
        <input type="radio" name="yes/no" checked>
        <label>No</label>
        <input type="radio" name="yes/no" >
    </div> 
Run Code Online (Sandbox Code Playgroud)

很抱歉回答,尽管有很多类似的问题和答案,但对它们进行调整只是行不通...

jo_*_*_va 4

如果您希望输入和标签“底部对齐”,请尝试使用vertical-align: text-bottom.

input[type='radio'] {
  vertical-align: text-bottom;
  margin-bottom: 1px;
}
div {
  display: inline-block;
  border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)
<div class="col-sm-3">
    <label>Yes</label>
    <input type="radio" name="yes/no" checked>
    <label>No</label>
    <input type="radio" name="yes/no" >
</div>
Run Code Online (Sandbox Code Playgroud)