How to center div element? This is a question that ask many HTML beginners.
And this is not only question about centering. Frequently people do
not know how to center text or button inside div element or button , how
to center image inside div element, how to center div block on the
screen and many other variations...
In this article we will try to give simple instructions with samples how to make some most common HTML centering.
Center a text inside div:
This text is centered inside div
Code for centering text inside div
1 | <div align=center>This text is centered inside div</div> |
So, to div element is added align attribute with value center and we get centered text inside div element.
the complete tutorial go here