I searched for this issue but can't find it... my problem is with this radiobuttonlist that I am trying to align along with its label, but keep getting this.
as you can see the buttonlist has that fixed width that I just cannot change.. the red circle is where I wanna align the radio buttons. I tried to textalign="right" but it overlaps to second line due to that wide space before names(dr. mr...) like this... As you can see the width is fixed...
Below is my code... any ideas how to fix this silly problem??? thanks
<div style="padding:5px;"><label>Prefix *</label>
<asp:RadioButtonList id="Prefix" runat="server" TextAlign="Left" RepeatDirection="Vertical">
<asp:listitem id="Dr" runat="server" >Dr.</asp:listitem>
<asp:listitem id="Mr" runat="server" >Mr.</asp:listitem>
<asp:listitem id="Mrs" runat="server" >Mrs.</asp:listitem>
<asp:listitem id="Miss" runat="server" >Miss</asp:listitem>
<asp:listitem id="Ms" runat="server" >Ms.</asp:listitem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"
ControlToValidate="Prefix"
ErrorMessage="Prefix is required."
ForeColor="Red">
</asp:RequiredFieldValidator></div>
UPDATE -
I have the following css that is suppose to align all the labels like the "Prefix *"... so why is it affecting radiobuttons... and is there some kind of override to fix it?
label
{
width: 20em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block;
color: Black;
}
Assign an class name to the radiobutton list
<asp:RadioButtonList id="Prefix" runat="server" CssClass="radioButtonList" RepeatDirection="Vertical">
<asp:listitem Value="Dr">Dr.</asp:listitem>
<asp:listitem Value="Mr">Mr.</asp:listitem>
<asp:listitem Value="Mrs">Mrs.</asp:listitem>
<asp:listitem Value="Miss">Miss</asp:listitem>
<asp:listitem Value="Ms">Ms.</asp:listitem>
</asp:RadioButtonList>
And use the following CSS
.radioButtonList input
{
float: left;
}
.radioButtonList label
{
margin-left: 10px;
display: block;
text-align: left;
}