对齐和填充的ASP:的CheckBoxList [英] Alignment and padding for asp:CheckBoxList

查看:194
本文介绍了对齐和填充的ASP:的CheckBoxList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net的CheckBoxList如下:

I have an asp.net checkboxlist as follows:

    <asp:CheckBoxList ID="CheckBoxList_Genres" runat="server" RepeatColumns="3">
        <asp:ListItem Selected="True">Action</asp:ListItem>
        <asp:ListItem Selected="True">Comedy</asp:ListItem>
        <asp:ListItem Selected="True">Classics</asp:ListItem>
        <asp:ListItem Selected="True">Documentary</asp:ListItem>

[...]

我有两个问题:文字并不以每个复选框对齐,并在一些浏览器(Safari浏览器显着),还有就是复选框和文本(文本骑靠在复选框)之间没有任何填充。我知道张贴在这里的答案:
<一href=\"http://stackoverflow.com/questions/306252/how-to-align-checkboxes-and-their-labels-consistently-cross-browsers\">http://stackoverflow.com/questions/306252/how-to-align-checkboxes-and-their-labels-consistently-cross-browsers

I have two problems: the text does not align with each checkbox, and in some browsers (notably Safari), there is no padding between the checkbox and the text (the text rides up against the checkbox). I am aware of the answer posted here: http://stackoverflow.com/questions/306252/how-to-align-checkboxes-and-their-labels-consistently-cross-browsers

不过,我不知道如何实现在ASP这些风格:语境的CheckBoxList;我知道的CSS样式可以为的CheckBoxList进行设置,但不认为这可以让我单独设置样式的标签和复选框。帮助将AP preciated。

However, I can't work out how to implement these styles in the asp:checkboxlist context; I know that a css style can be set for the checkboxlist, but do not think that this allows me to set separate styles for the "label" and the "checkbox". Help would be appreciated.

推荐答案

您应该可以同样的方法适用于您的CheckBoxList控件的CssClass属性,你会经常复选框。

You should be able to apply the same methods to the CssClass property of your CheckBoxList control as you would a regular checkbox.

下面是一些CSS code我用旁边的一个ASP.net复选框列表缩进长文:

Here is some CSS code I used to indent long text next to an ASP.net check box list:

.chkChoice input 
{ 
    margin-left: -20px; 
}
.chkChoice td 
{ 
    padding-left: 20px; 
}

ASP.net:

ASP.net:

<asp:CheckBoxList id="ChkWork" runat="server" TabIndex="2" CssClass="chkChoice">

这篇关于对齐和填充的ASP:的CheckBoxList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆