how to align label within margin of a panel?

Discussion in 'ASP .Net' started by Steve Richter, May 22, 2007.

  1. 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
     
    Steve Richter, May 22, 2007
    #1
    1. Advertising

  2. Steve Richter

    bruce barker Guest

    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
    >
     
    bruce barker, May 22, 2007
    #2
    1. Advertising

  3. On May 22, 3:53 pm, bruce barker <> wrote:
    > 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.
     
    Steve Richter, May 23, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kay
    Replies:
    2
    Views:
    7,228
  2. Paul Lautman

    left align within centre align

    Paul Lautman, Mar 3, 2006, in forum: HTML
    Replies:
    3
    Views:
    597
    Paul Lautman
    Mar 3, 2006
  3. Cal Who
    Replies:
    1
    Views:
    452
    Alexey Smirnov
    May 16, 2010
  4. Cal Who
    Replies:
    4
    Views:
    599
    Cal Who
    May 17, 2010
  5. Knut Krueger
    Replies:
    8
    Views:
    325
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page