1: How to align the div to the center of its parent tag
Answer: First of all, we have to define a width for this div, then margin:0 Auto; <div style= "width:960px;margin:0 Auto" >
2: Today accidentally found align and text-align, want to take a good look at the next one of their differences.
1.align: Specify the horizontal alignment of the content in the DIV element.
2.text-align: Specify the horizontal alignment of the text in "element".
Two properties are not used in the same place, but they work the same. Align is relatively "narrow", such as:
Align (align is the attribute of the DIV):
<div align= "Center" > This is some text!
</div>
Text-align (Text-align is the property of CSS):
<div style= "Text-align:center" >
Both can make the content of the div centered, it's best to try it yourself,
3: Do the test in 2 and find a problem
<TD align= ' center ' >
<table><tr><td></td></tr></table>
</td>
<TD style= ' Text-align:center ' >
<table><tr><td></td></tr></table>
</td>
The above two ways can not make the table in the TD Center alignment, because the align is almost abandoned, now the browser almost do not support this property,
The text-align:center can only align the contents of the elements, not the elements inside the element (equivalent to text only)
4: How to solve the problem of 3.
You have to start with the table element itself,
<TD >
<table style= ' margin:0px auto ' ><tr><td></td></tr></table>
</td> done.