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. Advertisements

  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. Advertisements

  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
    Likes Received:
    0
    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. Advertisements

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. King of Red Lions

    centering a div

    King of Red Lions, Jun 25, 2004, in forum: HTML
    Replies:
    1
    Views:
    533
  2. =?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:
    699
    cwdjrxyz
    Feb 17, 2006
  3. Uriah Piddle

    Centering a menu in a div

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

    centering div within a div

    Steve Richter, Jul 16, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    697
    Brandon Gano
    Jul 17, 2007
  5. Jeff
    Replies:
    6
    Views:
    1,326
    Göran Andersson
    Feb 18, 2009
  6. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    1,118
  7. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    477
    David Dorward
    Jun 1, 2005
  8. mscir
    Replies:
    3
    Views:
    556
    Martin Honnen
    Jun 26, 2005
Loading...