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.