Re: Cannot control the width of the label control



I once had that problem too, and I found that the problem is that the
element must also be a block element. To solve your problem, add the
following attribute:

style="display:inline-block;"

This will solve your problem. I add this attribute to many of my Label
controls when creating input forms, because it is more efficient than making
a table if you only have a few fields (not to mention specifying the
dimensions of table cells has given me more frustration than any other
layout aspect). Good Luck!
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/

"BobLaughland" <peter.mcclymont@xxxxxxxxx> wrote in message
news:1188861094.435908.171190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi There,

I am trying to get some fields to align on a web page, like this,

To:
From:
Subject:

Each of the fields above have a corresponding asp:Textbox control next
to it that I cannot get to lign up. I have this code,

<asp:Label Runat="server" Width="100px" ID="Label6">To: </
asp:Label>
<asp:TextBox ID="Textbox1" Runat="server" Width="200px" />
<asp:Label Runat="server" ID="Label7" ForeColor=red Width="5px">*</
asp:Label>

So that means I have tried to tell it that I want the asp:label
control to be 100 pixels wide, but it seems to shrink the label width
to fit the text.

Please help.



.



Relevant Pages