天冬氨酸:复选框复选框和文本不在同一行 [英] Asp:CheckBox checkbox and text are not on the same line
问题描述
我似乎无法弄清楚如何获得的复选框,相关的文字出现在一行。文字很短,所以它似乎并不成为一个问题的宽度。
我试图设置显示:直列上的控制,但是当它的呈现,跨度是围绕输入和标签并将具有该显示:内联。
如果我手动添加显示:内联,使用Chrome的资源来看,所得到的标签,比它的罚款。问题是我不知道怎么去控制做到这一点。
I can't seem to figure out how to get the checkbox and associated text to appear on one line. The text is very short so it doesn't seem to be a width issue. I tried setting display:inline on the control but when it's rendered, a span is added around the input and label and that has the display:inline. If I manually add the display:inline, using the resources view in Chrome, to the resulting label than it's fine. The problem is I don't know how to get the control to do this.
感谢。
推荐答案
您想拥有显示:应用于
的ASP生成保持标签文本,而不是控制本身的元素。因此,例如:&LT内联
;标签>
You want to have display:inline
applied to the <label>
element that ASP generates to hold the label text, not the control itself. So, for example:
<style type="text/css">
label { display: inline-block; }
</style>
<asp:CheckBox Text="This text appears on same line as checkbox" runat="server" />
这篇关于天冬氨酸:复选框复选框和文本不在同一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!