0

我的代码如下,由软件生成,我无法更改任何值。

<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;
}
4

2 回答 2

0

你可以使用css封面,

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

添加类'single',如下所示:

<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该类前面的任何父亲

像这样添加类:

$('#cred_form_3584_1_wpcf-ticket-month-or-course-radios').addClass('single');
于 2013-01-15T06:34:57.993 回答
0

id 应该是唯一的

你可以定位

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

也就是说,您要定位的类,但前提是它是给定 id 的后代

于 2013-01-15T06:59:50.660 回答