2013-01-15 67 views
0

我的代碼如下所示,由軟件生成,我無法更改任何值。無線電按鈕horzontally與css而不更改html代碼

<div class="cred-field cred-field-ticket-month-or-course"> 
<div class="cred-label">Month or Course</div> 
<div id="cred_form_3584_1_wpcf-ticket-month-or-course-radios" class="myzebra-radios"> 
<div class="myzebra-radios-single"> 
<label class="myzebra-style-label"> 
<input id="cred_form_3584_1_wpcf-ticket-month-or-course_wpcf-fields-radio-option-a6da15467aeb84f539c0dc1cd766ccd6-2" class="myzebra-control myzebra-radio myzebra-prime-name-wpcf-ticket-month-or-course" type="radio" checked="checked" value="wpcf-fields-radio-option-a6da15467aeb84f539c0dc1cd766ccd6-2" name="wpcf-ticket-month-or-course"> 
<span class="myzebra-radio-replace"></span> 
</label> 
<label id="cred_form_3584_1_label_wpcf-ticket-month-or-course_wpcf-fields-radio-option-a6da15467aeb84f539c0dc1cd766ccd6-2" for="cred_form_3584_1_wpcf-ticket-month-or-course_wpcf-fields-radio-option-a6da15467aeb84f539c0dc1cd766ccd6-2">per month</label> 
</div> 
<div class="myzebra-radios-single"> 
<label class="myzebra-style-label"> 
<input id="cred_form_3584_1_wpcf-ticket-month-or-course_wpcf-fields-radio-option-f63eb739e2a6499a882c8e82aa35b028-1" class="myzebra-control myzebra-radio myzebra-prime-name-wpcf-ticket-month-or-course" type="radio" value="wpcf-fields-radio-option-f63eb739e2a6499a882c8e82aa35b028-1" name="wpcf-ticket-month-or-course"> 
<span class="myzebra-radio-replace"></span> 
</label> 
<label id="cred_form_3584_1_label_wpcf-ticket-month-or-course_wpcf-fields-radio-option-f63eb739e2a6499a882c8e82aa35b028-1" for="cred_form_3584_1_wpcf-ticket-month-or-course_wpcf-fields-radio-option-f63eb739e2a6499a882c8e82aa35b028-1">per course</label> 
</div> 
</div> 
</div> 
<div style="clear: both;"></div> 

我需要幫助把這個單選按鈕並排(水平)。

我不能這樣做,因爲它會影響同一頁上的其他單選按鈕。還有其他技術嗎?

.myzebra-radios-single { 
    float: left; 
} 
+0

提供小提琴 – I29

回答

0

您可以使用CSS覆蓋,

<div id="cred_form_3584_1_wpcf-ticket-month-or-course-radios" class="myzebra-radios"> 

添加類 '單',像這樣:

<div id="cred_form_3584_1_wpcf-ticket-month-or-course-radios" class="myzebra-radios single"> 

和CSS代碼:

.single .myzebra-radios-single{ float:none;} 

single類可以添加到任何.myzebra-radios-single父親在全班同學面前

addclass這樣的:

$('#cred_form_3584_1_wpcf-ticket-month-or-course-radios').addClass('single'); 
0

ID應該是唯一的

你可以針對

#cred_form_3584_1_wpcf-ticket-month-or-course-radios .myzebre-radios-single 

就是要在類目標,但只有當它是給定ID的後代