468,234 Members | 1,665 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,234 developers. It's quick & easy.

how to align label within margin of a panel?

I want my panel to have an inner margin. Problem is label text does
not appear to recognize the margin. In this example, the TextBox
aligns on the margin, the label does not:

<asp:Panel id="Panel1" runat="server"
BackColor="gainsboro"
Scrollbars=Both Style="margin:25px;"
Height="200px"
Width="300px">

Panel1: Here is some static content...
<br />

<asp:Label Text="Label 1" runat=server />
<br />
<asp:TextBox ID=TextBox1 runat=server />
</asp:Panel>

What is the correct HTML/CSS way to get text to recognize the margin
of a div?

thanks,

-Steve

May 22 '07 #1
2 10322
a div's margin is outside its content area and border. what you want to
set is padding.

style="padding:25px;"
or set the margin of the label.
-- bruce (sqlwork.com)

Steve Richter wrote:
I want my panel to have an inner margin. Problem is label text does
not appear to recognize the margin. In this example, the TextBox
aligns on the margin, the label does not:

<asp:Panel id="Panel1" runat="server"
BackColor="gainsboro"
Scrollbars=Both Style="margin:25px;"
Height="200px"
Width="300px">

Panel1: Here is some static content...
<br />

<asp:Label Text="Label 1" runat=server />
<br />
<asp:TextBox ID=TextBox1 runat=server />
</asp:Panel>

What is the correct HTML/CSS way to get text to recognize the margin
of a div?

thanks,

-Steve
May 22 '07 #2
On May 22, 3:53 pm, bruce barker <nos...@nospam.comwrote:
a div's margin is outside its content area and border. what you want to
set is padding.

style="padding:25px;"

or set the margin of the label.

-- bruce (sqlwork.com)
thanks.

May 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Robert Nicholson | last post: by
32 posts views Thread by Axel Dahmen | last post: by
3 posts views Thread by Mark | last post: by
2 posts views Thread by Wilfried Mestdagh | last post: by
2 posts views Thread by swapna_munukoti | last post: by
Ciary
2 posts views Thread by Ciary | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.