<center> tag is deprecated. How to do center aligning without this tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

<center> tag is deprecated. How to do center aligning without this tag?

19th Jan 2016, 11:53 PM
Richard
4 Answers
+ 1
use the align attribute e.g. <hr align="center"/>
28th Mar 2016, 1:07 PM
Daniel Chukwuji
Daniel Chukwuji - avatar
+ 1
you can also go with the CSS approach. to center the text inside any element. HTML <div>Centered text.</div> CSS div {text-align: center;} also if you would like to have the whole div centered on the html page. HTML <div>Centered text.</div> CSS div { width: ( specify some width here. ); margin-left: auto; margin-right: auto; } or to set margin in one line margin: 0 auto; or to apply custom top and bottom margin margin: 5px auto 15px auto;
29th May 2016, 7:57 AM
Hiren
0
Use CSS and then reference that in a <div class=""></div>
30th Jan 2016, 9:36 PM
Calvin Hodgson
Calvin Hodgson - avatar
0
align="center"
29th Jun 2016, 7:53 PM
Varun Rajput
Varun Rajput - avatar