How to Center Align a Panel.

Discussion in 'ASP .Net' started by Dinesh, Oct 9, 2006.

  1. Dinesh

    Dinesh Guest

    Dear All,
    Can u tell me how to center align a div (Panel) in Asp.Net 2.0.
    If we use align="center" then it will be converted to text-align:center
    which will align all the content of the div's object but not the div
    itself. Also this is only valid in IE in case of mozilla even that
    don't work. If we use <center></center> then it will work in both the
    browsers but its a depreciated tag. So could any 1 tell me the best way
    of that.

    thanks in advance.
    Deepak.
     
    Dinesh, Oct 9, 2006
    #1
    1. Advertising

  2. Hi Dinesh,

    It's strictly HTML/CSS, not asp.net 2.0. Panel must be placed inside a
    container that has align set to center, i.e.

    <table width="100%">
    <tr>
    <td align="center">
    <asp:panel runat="server" ID="MyCenteredPanel"/>
    </td>
    </tr>
    </table>

    or

    <div style="text-align:center; width: 100%">
    <asp:panel runat="server" ID="MyCenteredPanel"/>
    </div>
    --
    Milosz Skalecki
    MCP, MCAD


    "Dinesh" wrote:

    > Dear All,
    > Can u tell me how to center align a div (Panel) in Asp.Net 2.0.
    > If we use align="center" then it will be converted to text-align:center
    > which will align all the content of the div's object but not the div
    > itself. Also this is only valid in IE in case of mozilla even that
    > don't work. If we use <center></center> then it will work in both the
    > browsers but its a depreciated tag. So could any 1 tell me the best way
    > of that.
    >
    > thanks in advance.
    > Deepak.
    >
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=, Oct 9, 2006
    #2
    1. Advertising

  3. Place the centered div in another div that is set to center.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com

    *************************************************
    Think outside of the box!
    *************************************************
    "Dinesh" <> wrote in message
    news:...
    > Dear All,
    > Can u tell me how to center align a div (Panel) in Asp.Net 2.0.
    > If we use align="center" then it will be converted to text-align:center
    > which will align all the content of the div's object but not the div
    > itself. Also this is only valid in IE in case of mozilla even that
    > don't work. If we use <center></center> then it will work in both the
    > browsers but its a depreciated tag. So could any 1 tell me the best way
    > of that.
    >
    > thanks in advance.
    > Deepak.
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 9, 2006
    #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. VB Programmer

    Question: TextBox - Can't Align Center

    VB Programmer, Aug 27, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    16,541
    Grant
    Aug 27, 2003
  3. tshad

    text-align vs align

    tshad, Jun 23, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,325
    David Dorward
    Jun 23, 2005
  4. Paul Lautman

    left align within centre align

    Paul Lautman, Mar 3, 2006, in forum: HTML
    Replies:
    3
    Views:
    597
    Paul Lautman
    Mar 3, 2006
  5. Steve Richter
    Replies:
    1
    Views:
    939
    Mark Rae
    Jun 24, 2007
Loading...

Share This Page