How to center align the Div or Table in .net

M trying to align = "Center", but it says its outdated method, Can u suggest me a solution to this
HelpSunnyAsked:
Who is Participating?
 
Jon500Commented:
There is:
text-align:center;

Also:
margin: 0 auto;

The first is good for text while the second is good for a nested DIV that it inside another "parent" DIV.

Regards,
Jon500
0
 
Jon500Commented:
In case it wasn't clear:

<DIV style="width:100%;text-align:center">Hi there.</DIV>

Cheers,
Jon500
0
 
hehdaddyCommented:
<div style="margin-left:auto; margin-right:auto"></div>

That should center it for you.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
apexpertCommented:
use  style="
width:100%;
 text-align:center;
margin-left=--px;
margin-right=--px;
 "
any
if its not work then use one parent table wiht width=100%,  align=center,  border=0
0
 
HelpSunnyAuthor Commented:
Can a table be created inside a row or a column? M trying to that but its not accepting.
0
 
Jon500Commented:
*** Can a table be created inside a row or a column? M trying to that but its not accepting. ***

This is a separate question entirely, is it not? Please review EE rules.

We tried to help you with your first question... Did we?

Regards,
Jon500
0
 
rajeeshmcaCommented:
You cannot create a table within a row. U can only create table within a cell like

<table>
  <tr>
     <td>
         <table>
           <tr>
                  <td>
                  </td>
           </tr>
          </table>
     </td>
   </tr>
</table>
0
 
apexpertCommented:
U can only create table within a cell mins in <td></td>

<table width=100% border=0>
   <tr>
         <td width=100%>
<!-- Your Design will start from there -->
         </td>
   </tr>
</table>
0
 
HelpSunnyAuthor Commented:
Thank U
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.