Re: Cannot control the width of the label control
- From: BobLaughland <peter.mcclymont@xxxxxxxxx>
- Date: Mon, 03 Sep 2007 17:27:22 -0700
On Sep 4, 11:38 am, "Nathan Sokalski" <njsokal...@xxxxxxxxxxx> wrote:
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
njsokal...@xxxxxxxxxxxxxxx://www.nathansokalski.com/
"BobLaughland" <peter.mcclym...@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.- Hide quoted text -
- Show quoted text -
Great, you are on the money.
I have a CSS file which I want to put it into. How do I do that?
The label I want to control is wrapped in side a div.
<div class="EmailEntry">
<asp:Label Runat="server" ID="Label1" >To: </asp:Label>
<asp:TextBox ID="ToField" Runat="server" Width=80% />
..............
.............
</div>
So if I put this into my css why does it not work?
div.emailentry label
{
display: inline-block; /* or inline block, which ever one you
think looks better */
width: 80px;
}
I have also tried 'div.emailentry label1' but that didn't work either.
.
- Follow-Ups:
- Re: Cannot control the width of the label control
- From: Nathan Sokalski
- Re: Cannot control the width of the label control
- From: bruce barker
- Re: Cannot control the width of the label control
- From: marss
- Re: Cannot control the width of the label control
- References:
- Cannot control the width of the label control
- From: BobLaughland
- Re: Cannot control the width of the label control
- From: Nathan Sokalski
- Cannot control the width of the label control
- Prev by Date: Re: autocomplete=off is not XHTML compliant
- Next by Date: ASPNet 2.0 TextBox mask question
- Previous by thread: Re: Cannot control the width of the label control
- Next by thread: Re: Cannot control the width of the label control
- Index(es):
Relevant Pages
|
Loading