2014-03-06 164 views

回答

0

最簡單的方法是製作標籤塊元素並將它們浮動:

DEMO

label { 
    width: 32px; 
    height: 29px; 
    cursor: pointer; 
    position: relative; 

    display: block; 
    float: left; 
    line-height: 29px; 
} 

你需要調整行高,以保持在垂直中心的文本。


或者,如果這是不切實際的,只是刪除您標記的白色空間:

此:

<input id="appointment-yes" type="radio" name="set-appointment" value="yes" /> 
<label class="yes-label" for="appointment-yes"></label> 
<input id="appoinment-no" type="radio" name="set-appointment" value="no" /> 
<label class="no-label" for="appoinment-no"></label> 

變爲:

<input id="appointment-yes" type="radio" name="set-appointment" value="yes" /><label class="yes-label" for="appointment-yes"></label><input id="appoinment-no" type="radio" name="set-appointment" value="no" /><label class="no-label" for="appoinment-no"></label> 

DEMO

+0

謝謝。我最終增加了margin-right:-3px;我的.yes標籤解決了這個問題。 – ObviousCat