How to center align table or div using css

In this tutorial we will learn how to center align div or table using css. You can center align both of these html tags by using <center> tag. However, in web browsers such as Firefox and Flock or websites which adhere to stricter standards like xHTML 1.0 Strict, align="center" will be ignored, as align attribute has deprecated in preference of styles attribute instead. For text only, align attribute can be substituted with text-align tag as a workaround, but for other elements such as image, it will continue to align to the left, and not center. Moreover, you should know how you can center align div or table using css.
By following strict web coding standard, in order to center a block-type object within another block type object, you have to use the following code on the object that you wants to be centered (i.e. on the inner object):
style="margin-left:auto; margin-right:auto;"
style="margin:0 auto;"
So for aligning div tag on center, you will use following html code
This line of text will be centered
I hope you will find this tutorial very handy. Your comments are welcome.