简体   繁体   English

css到asp.net中的手风琴菜单中的checkboxlist控件

[英]css to checkboxlist control in accordion menu in asp.net

I want to change the default style of checkboxlist available in websforms, I can apply changes to the text but cant change the checkbox which looks better and appealing. 我想更改websforms中可用的复选框列表的默认样式,我可以将更改应用于文本,但不能更改看起来更好且更具吸引力的复选框。

<div id="left_columnforSale">   
 <asp:Accordion ID="Accordion1" runat="server" SelectedIndex="0" HeaderCssClass="accordHeader" ContentCssClass="accordContent" HeaderSelectedCssClass="accordHeaderSelected"
           AutoSize="None"
            FadeTransitions="true"
            TransitionDuration="50"
            FramesPerSecond="20"
            RequireOpenedPane="false"
            SuppressHeaderPostbacks="True">
            <Panes>
              <asp:AccordionPane>
               <Header>
                &nbsp;&nbsp;&nbsp;CheckListBox
                </Header>
                 <Content>
                    <asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged" CssClass="chkbox">
                    <asp:ListItem Value="0 AND 1000">0 - £1,000</asp:ListItem>
                    <asp:ListItem Value="1000 AND 2000">£1,000 - £2,000</asp:ListItem>
                    <asp:ListItem Value="2000 AND 3000">£2,000 - £3,000</asp:ListItem>
                    <asp:ListItem Value="3000 AND 4000">£3,000 - £4,000</asp:ListItem>
                    <asp:ListItem Value="4000 AND 5000">£4,000 - £5,000</asp:ListItem>
                    <asp:ListItem Value="5000 AND 6000">£5,000 - £6,000</asp:ListItem>
                    <asp:ListItem Value="6000 AND 7000">£6,000 - £7,000</asp:ListItem>
                    <asp:ListItem Value="7000 AND 8000">£7,000 - £8,000</asp:ListItem>
                    <asp:ListItem Value="8000 AND 9000">£8,000 - £9,000</asp:ListItem>
                    <asp:ListItem Value="9000 AND 10000">£9,000 - £10,000</asp:ListItem>

                    </asp:CheckBoxList>

                </Content>

            </asp:AccordionPane>

            </Panes>
 </asp:Accordion>

CSS: CSS:

#left_columnforSale .accordContent
{
color: #999999;
font-size: 11px;

}
#left_columnforSale .accordContent .chkbox td:hover
{
color: #606060;
text-decoration: underline;
cursor: pointer;
 }

Any tutoria;l or help will be appreciated thnx 任何教学或帮助将不胜感激

First off, note that checkboxes are far from flexible. 首先,请注意复选框远非灵活。 Browsers don't let you style them that much with CSS. 浏览器不允许您使用CSS设置样式太多。 Any pure-css solution that you won't change the look of your checkboxes that much... For any serious style change, you will have to code something in javascript that acts like a checkbox. 您不会改变复选框外观的任何纯css解决方案...对于任何严重的样式更改,您都必须在javascript中编写类似于复选框的代码。

If your changes are minor / can be done in css : 如果您所做的更改很小/可以在CSS中完成:

If you want to style all checkboxes directly in your css, use the following code : 如果要直接在CSS中设置所有复选框的样式,请使用以下代码:

input[type="checkbox"]{
    /* Here are the styles that will be applied to ALL checkboxes */
}

Now if you want something particular for some checkboxes, you can go with classes. 现在,如果您想要某些复选框的特定功能,则可以使用类。 By applying a CSS class to your checkbox directly. 通过直接将CSS类应用于复选框。 CssClass is a property for standard web controls in ASP.NET so you can apply it to CssClass是ASP.NET中标准Web控件的属性,因此您可以将其应用于

<asp:ListItem CssClass="checkbox" Value="0 AND 1000">0 - £1,000</asp:ListItem>

for example. 例如。

From there, in your css 从那里,在你的CSS

.checkbox {
    /* Here are the styles that apply to checkboxes that have the checkbox css class */
}

If you can't do it with CSS : Here are a couple of examples of what you can do with javascript / css : http://www.no-margin-for-errors.com/projects/prettycheckboxes/ http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/ 如果你不能用CSS做到这一点:这里有一对夫妇,你可以用JavaScript / CSS做什么的例子: http://www.no-margin-for-errors.com/projects/prettycheckboxes/ HTTP:// ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM