【发布时间】:2018-09-20 23:02:44
【问题描述】:
下面是当前页面外观的sn-p。
Radio buttons and their labels not in single line
下面是正在使用的一段代码。 (JSP)
<div class="leftFormComp" style="width: 100%;">
<label class="inputLabel" for="ext-comp-1045">
<span class="required">*</span><fmt:message key="registration.agreement"/>
</label>
<div id="x-form-el-ext-comp-1045" class="x-form-element" style="padding-left: 8px;">
<div id="ext-comp-1045" class=" x-form-checklist" style="width: 344px; height: auto;">
<div class="x-form-cb-li x-form-cb-li-h" style="padding-bottom: 5px">
<input id="termsAgree-Y" class="x-form-field" type="radio" value="Y" name="termsAgree"> <label class="x-form-cb-label" for="termsAgree-Y"><fmt:message key="registration.yes"/></label>
</div>
<div class="x-form-cb-li x-form-cb-li-h">
<input id="termsAgree-N" class="x-form-field" type="radio" value="N" name="termsAgree"> <label class="x-form-cb-label" for="termsAgree-N"><fmt:message key="registration.no"/></label>
</div>
</div>
</div>
</div>
我尝试过使用像
这样的内联样式display: inline!important;
带有输入和标签标签,但没有任何效果。
在 Chrome 开发人员模式下检查时,我发现了一个额外的属性,该属性被附加在两个单选按钮的输入标签中,我无法弄清楚它来自哪里。
element.style {
display: block;
}
有人可以建议方法来覆盖在此元素上实现的所有现有样式,以便将单选按钮及其标签放在一行中。我是前端部分的新手,所以请帮助我。另外,帮我找出这个样式的来源(可以使用 Chrome 开发者工具找到)
【问题讨论】:
-
您正在检查哪个元素正在获取 display:block 分配?你把 display:inline!important 放在了哪个 CSS 选择器上?你所有的 CSS 和 JavaScript 都是自定义的吗?
标签: javascript jquery html css jsp