none
Html Table is not positioned center inside div in ASP.Net RRS feed

  • Question

  • Hi,

    I am using .Net 2012 IDE and I have done in the following way to position a table inside div in canter align. but this is not working.

     <div style="width: 100%; text-align: center; vertical-align: middle">
                Sample text out of table
                <table>
                    <tr>
                        <td>Hello world..</td>
                    </tr>
                </table>
            </div>

    but, if some thing is out of table and inside div like (Sample text out of table) as seen above is been positioned at centre.

    Can I get any ideas on why I am getting this situation please.

    Thanks

    Sreenath


    Cheers Sreenath G V


    • Edited by Sreenath GV Wednesday, March 6, 2013 6:46 AM
    Wednesday, March 6, 2013 6:46 AM

Answers

  • Got the solution...
    <div style="width: 100%; text-align: center; vertical-align: middle">
                Sample text out of table
                <table style="margin-right: auto; margin-left: auto;">
                    <tr>
                        <td>Hello world..</td>
                    </tr>
                </table>
            </div>

    Thanks... :)

    Cheers Sreenath G V

    • Marked as answer by Sreenath GV Wednesday, March 6, 2013 6:51 AM
    Wednesday, March 6, 2013 6:51 AM

All replies

  • Got the solution...
    <div style="width: 100%; text-align: center; vertical-align: middle">
                Sample text out of table
                <table style="margin-right: auto; margin-left: auto;">
                    <tr>
                        <td>Hello world..</td>
                    </tr>
                </table>
            </div>

    Thanks... :)

    Cheers Sreenath G V

    • Marked as answer by Sreenath GV Wednesday, March 6, 2013 6:51 AM
    Wednesday, March 6, 2013 6:51 AM
  • Hi,

    We are happy that your issue has been resolved. And thanks for sharing solutions.

    Best Regards,

    Pengzhen

    Wednesday, March 6, 2013 10:59 AM