centering <div> in <TD>

Discussion in 'HTML' started by shank, Sep 30, 2003.

  1. shank

    shank Guest

    <td style="width:150px; text-align:center; vertical-align:top">

    I'm trying to center a <DIV> within a table cell.
    I have the above code for that cell.
    Alas, the <DIV> is staying left aligned or default an will not center.
    Am I missing something?
    thanks!
     
    shank, Sep 30, 2003
    #1
    1. Advertising

  2. shank wrote:

    > <td style="width:150px; text-align:center; vertical-align:top">


    > I'm trying to center a <DIV> within a table cell.
    > I have the above code for that cell.


    You have tabular data that includes a <div>? How odd.

    > Alas, the <DIV> is staying left aligned or default an will not center.
    > Am I missing something?


    Div elements aren't inline (text).

    http://dorward.me.uk/www/centre/#block

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Sep 30, 2003
    #2
    1. Advertising

  3. shank

    Mark Nobles Guest

    In article <oFmeb.29935$>, shank
    <> wrote:

    > <td style="width:150px; text-align:center; vertical-align:top">
    >
    > I'm trying to center a <DIV> within a table cell.
    > I have the above code for that cell.
    > Alas, the <DIV> is staying left aligned or default an will not center.
    > Am I missing something?
    > thanks!


    Yep.
    margin-left:auto; margin-right:auto;
     
    Mark Nobles, Oct 1, 2003
    #3
  4. shank

    Zibanani Jopi

    Joined:
    Jul 27, 2012
    Messages:
    1
    trying to center the text div

    m trying to center the text in a div and it does centers but is on top of the website,how do i bring it down on stage?
     
    Zibanani Jopi, Jul 27, 2012
    #4
    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. David Graham

    Re: centering a div

    David Graham, Jul 6, 2003, in forum: HTML
    Replies:
    0
    Views:
    455
    David Graham
    Jul 6, 2003
  2. King of Red Lions

    centering a div

    King of Red Lions, Jun 25, 2004, in forum: HTML
    Replies:
    1
    Views:
    420
  3. =?ISO-8859-1?Q?=22H=2E_M=E4ki=22?=

    Centering div

    =?ISO-8859-1?Q?=22H=2E_M=E4ki=22?=, Feb 16, 2006, in forum: HTML
    Replies:
    2
    Views:
    583
    cwdjrxyz
    Feb 17, 2006
  4. Uriah Piddle

    Centering a menu in a div

    Uriah Piddle, Feb 18, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    John Timney \(MVP\)
    Feb 18, 2007
  5. Steve Richter

    centering div within a div

    Steve Richter, Jul 16, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    507
    Brandon Gano
    Jul 17, 2007
Loading...

Share This Page