What is the HTML <center> tag?
Overview
Traditionally in <center> tag to align text in a centered horizontal manner. This <center> element is no longer supported in HTML5, as it got deprecated in HTML4.
Now the text-align property provides multiple features to align text or blocks of text such as:
margin-rightmargin-leftauto
We can apply these attributes individually on blocks like <div>, <p>, etc.
Syntax
<center> content will be here.... </center>
CSS property text-align
For the latest browsers, we can use CSS to align text in different ways such as: center, right, and left.
We can use CSS in different ways, as shown below.
styleattribute on<p>
<p>
This line will be centered.<br> am I centered aligned?
</p>
styleattribute on<div>
<div> This text will be centered.
<p> hello, I am centered aligned. </p>
</div>
Code
This code snippet shows how to use the <center> element in your HTML code. This prints the <p> (paragraph) tag as centered text using CSS to increase the font-size and its color.