2013-05-22 92 views
9

對齊複選框見http://jsbin.com/ocutob/1/edit具有多行標籤

<span> 
    <input checked="checked" type="checkbox" value="1"> 
    <label>test test test test test test test test test test test test </label> 
</span> 

該如何調整的複選框:頂部,底部和中間?

我會做與另一個容器和使用定位,但有一個更簡單的方法嗎?

回答

3

答案2015年:
由於vertical-align不起作用對於我(或不再),這裏是我該怎麼做:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>Radiobutton labels aligned</title> 
<style type="text/css"> 
    div { display:table-row; } 
    div span { display:table-cell; vertical-align:middle; } /* You can omit the entire span if you don't want the radiobutton vertically centered */ 
    div label { display:table-cell; } 
</style> 
</head> 
<body> 
<form> 
<div> 
    <span><input type="checkbox" id="a"></span> 
    <label for="a">First button's label<br>First button's label</label> 
</div> 
<div> 
    <span><input type="checkbox" id="b"></span> 
    <label for="b">Second button's label</label> 
</div> 
<input type="checkbox" id="c"><label for="c">For comparison: Standard-Label</label> 
</form> 
</body> 
</html> 

請參閱http://jsfiddle.net/8jzss08p/
適用於:Firefox 41,Chrome 45,Internet Explorer 11