css - 将输入复选框放在标签的同一行

标签 css html input

我正在努力将输入复选框放置在与标签相同的 x 水平线上。我的复选框位于第二行。我有一个 div,背景是图像,然后是标签,然后是复选框。图像和标签 div 之间的边距以及标签和检查之间的边距需要相同。非常感谢。

<div id="map_Marker_Check_Block">
 <div class="markerDiv"  id="maker_school"><div class="marker_label">School</div> <input class="marker_ckeckbox" name="markerType" value="school" type="checkbox"  /> </div> <br />
 <div class="markerDiv"  id="maker_gym"> <div class="marker_label">Gym</div> <input class="marker_ckeckbox" name="markerType" value="gym" type="checkbox" /> </div><br />
</div>

CSS

#map_Marker_Check_Block {
background-color:yellow;
display:block;
position:absolute;
width:20em;
height:400px;
top:0;
right:0;
z-index:10;
overflow-y:auto;
}

.marker_label {
margin-left:50px;
line-height:48px;
width:130px;
background-color:green;
}

.marker_ckeckbox {   
float:right; 
}

.markerDiv {
width:19em;
height:48px;
margin-left:5px;
}

#maker_school {  background: url("img1.png") no-repeat; }

#maker_gym{   background: url("img2.png") no-repeat;   }

最佳答案

http://jsfiddle.net/XUErp/

.marker_label {
    float:left;
    margin-left:50px;
    line-height:48px;
    width:130px;
    background-color:green;
}
.marker_ckeckbox {
    margin-top:15px;
    float:right;
}

关于css - 将输入复选框放在标签的同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17454795/

相关文章:

c++ - C++、cin、cout、threads 和 sync_with_stdio 的损坏输出

python - 从 input() 中提取参数

javascript - CSS/Javascript Spinner 对齐文本中间

css - 纯 CSS 锁定表头 - 带垂直和水平滚动条的可变宽度和高度

html - 在 Bootstrap 中将图像置于另一个图像的中心

php - 输入不显示完整值

javascript - 如何在网页中添加幻灯片图片

html - 调整大小时 IE10 背景图像伪像

html - 无法在 Safari 中渲染 SVG 图像

javascript - 错误检查输入,Javascript