Reputation: 1060
I'm working with an ASP.NET page that has a number of dropDownList controls. I'm trying to apply formatting so I can fit it into a small panel without the longer named list items blowing out the control. I applied a % width to them, which fixes the problem of it fitting, but then the control gets misaligned. Trying to figure out how to get the display to go to the left if there isn't any more room on the other side of the control.
Here's the drop down:
<asp:DropDownList
ID="ddlDownloadsSector"
AutoPostBack="true"
CssClass="ddlstyle"
EnableViewState="true"
OnSelectedIndexChanged="ddlDownloadsSector_SelectedIndexChanged"
runat="server" />
and here's the style:
.ddlstyle
{
width: 35%
}
Upvotes: 0
Views: 196
Reputation: 89
Formatting dropdowns in HTML is a pain (and usually not recommended IIRC) because each browser handles them differently. I do not believe that you can do text wrapping within the dropdowns; even if it is possible, I can imagine there would be some issues between browsers. If you can, I would shorten the content in the dropdown that is causing the issue. If you really have to have the distinction, make a javascript event that displays a new dropdown with the distinguishing feature.
EDIT: As Mike points out in his comment, you could use some UI framework to get around this, but I think that if you are just using plain CSS/HTML/JS, then your options are limited.
Upvotes: 2