css 到 asp.net 中的手风琴菜单中的复选框列表控件
我想更改网络表单中可用的复选框列表的默认样式,我可以对文本应用更改,但无法更改看起来更好、更有吸引力的复选框。
<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>
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:
#left_columnforSale .accordContent
{
color: #999999;
font-size: 11px;
}
#left_columnforSale .accordContent .chkbox td:hover
{
color: #606060;
text-decoration: underline;
cursor: pointer;
}
任何教程或帮助将不胜感激 谢谢
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.
<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>
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:
#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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,请注意复选框远非灵活。浏览器不允许您使用 CSS 对其进行过多的样式设置。任何纯 CSS 解决方案都不会改变复选框的外观......对于任何严重的样式更改,您都必须在 javascript 中编写一些类似于复选框的代码。
如果您的更改很小/可以在 css 中完成:
如果您想直接在 css 中设置所有复选框的样式,请使用以下代码:
现在,如果您想要某些复选框有特定的内容,您可以使用类。通过直接将 CSS 类应用到您的复选框。 CssClass 是 ASP.NET 中标准 Web 控件的一个属性,因此您可以将其应用于
其他示例。
从那里,在你的 css 中
如果你不能用 CSS 做到这一点:
以下是一些可以使用 javascript / css 进行操作的示例:
http://www.no-margin-for-errors.com/projects/漂亮的复选框/
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
First off, note that checkboxes are far from flexible. Browsers don't let you style them that much with 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.
If your changes are minor / can be done in css :
If you want to style all checkboxes directly in your css, use the following code :
Now if you want something particular for some checkboxes, you can go with classes. By applying a CSS class to your checkbox directly. CssClass is a property for standard web controls in ASP.NET so you can apply it to
for example.
From there, in your css
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/