疯了!
为什么 Label 元素不与所有内容对齐?
我将所有行高设置为 24px,inline-blocks。
此处示例:http://jsfiddle.net/kMtYN/
html {
font-size: 16px;
font-family:'Lucida Grande', 'Trebuchet MS';
}
.ims-div {
height: 24px;
background: gray;
}
.ims-span {
display: inline-block;
width: 24px; height: 24px;
background: green url('is-check-small-sprite-blue.png') 0 -72px no-repeat;
}
.ims-label {
display: inline-block;
line-height: 24px;
margin: 0; padding: 0; border: 0;
background: purple;
color: white;
font-weight: normal;
}
<div class="ims-div">
<span class="ims-span"></span>
<label class="ims-label">CheckBox 1</label>
</div>
最佳答案
http://jsfiddle.net/SebastianPataneMasuelli/kMtYN/1/
在标签和跨度中添加了vertical-align:middle
关于标签的 CSS 让我发疯,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4270040/