向右移动单选按钮
Moving a radio button to the right
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
</div>
我想将按钮和标签向右移动以对齐下面的文本框。
如何移动它?
在这种情况下(看起来像只有 2 个 div 的硬编码),您可以使用 CSS.
中的 :last-child 选择器来完成
这是 CSS-
.row {
div:last-child {
padding-left: 20px; //or any other of choice
}
如果你想要它用于变量输入等,请更新你的问题,OP!
使用display:-webkit-box;希望能解决你的问题。
.row{
display:-webkit-box;
}
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
</div>
<style>
/* Remove default paddings, margins around the elements */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
</style>
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
<div>
<input type="text".>
</div>
<div>
<input type="text".>
</div>
</div>
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
</div>
我想将按钮和标签向右移动以对齐下面的文本框。
如何移动它?
在这种情况下(看起来像只有 2 个 div 的硬编码),您可以使用 CSS.
中的 :last-child 选择器来完成这是 CSS-
.row {
div:last-child {
padding-left: 20px; //or any other of choice
}
如果你想要它用于变量输入等,请更新你的问题,OP!
使用display:-webkit-box;希望能解决你的问题。
.row{
display:-webkit-box;
}
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
</div>
<style>
/* Remove default paddings, margins around the elements */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
</style>
<div class="row">
<div style="text-align:left;">
<input type="radio">
<label for="Employee">Employee</label>
</div>
<div style="text-align:left;">
<input type="radio">
<label for="Employer">Employer</label>
</div>
<div>
<input type="text".>
</div>
<div>
<input type="text".>
</div>
</div>