Asp.net CheckBoxList minimum width CSS style (good compatibility)

Source: Internet
Author: User

In ASP. NET, the options in the CheckBoxList are all automatic width, and the width settings are not set for the attribute.
Refer to the minimum width style on the Internet,
Copy codeThe Code is as follows:
/* Minimum degree of parallelism */
. Min_width {min-width: 300px;
/* Sets max-width for IE */
_ Width: expression (document. body. clientWidth <300? "300px": "auto ");
}

As follows:
Copy codeThe Code is as follows:
<Style>
. CkblstEffect td
{
Min-width: 80px;
_ Width: expression (document. body. clientWidth <80? "80px": "auto ");
}
</Style>

Copy codeThe Code is as follows:
<Asp: CheckBoxList ID = "ckblstEffect" runat = "server" DataTextField = "MC"
RepeatDirection = "Horizontal" RepeatColumns = "10" CssClass = "ckblstEffect"
DataValueField = "ID" ondatabound = "ckblstEffect_DataBound">
</Asp: CheckBoxList>

It does not work in the travel 4 compatibility mode (IE7). If you look at the expressions in the style carefully, you may feel wrong.
Change to the following style.
Copy codeThe Code is as follows:
<Style>
. CkblstEffect td
{
Min-width: 80px;
Width: expression (this. offsetWidth <80? "80px": "auto ");
}
</Style>

In IE10, travel 4, and compatibility modes, the minimum width can be correctly displayed. This style can be used in addition to CheckBoxList and DIV.

If other browsers cannot display the minimum width of the CheckBoxList option, please notify me.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.