<center></center> tags are used in HTML to center text or use a style sheet property.
Using the <center></center> tags
Using a style sheet property
Using a style sheet property : We can also center text using CSS. This is done using the text-align property on the element which contains the text you need to center.
If you have one or few blocks of text you need to center then you could include the style in the HTML code for the element, such as a <p></p> element, using the style attribute:
If you have many blocks of text you would like to center, you can use CSS inside <style></style> tags within the head section on the page to declare that every element be centered.
If you would like some paragraphs centered while others are not, you can create a style cl*** as seen in the below code.
Using the <center></center> tags
Using a style sheet property
Using a style sheet property : We can also center text using CSS. This is done using the text-align property on the element which contains the text you need to center.
If you have one or few blocks of text you need to center then you could include the style in the HTML code for the element, such as a <p></p> element, using the style attribute:
<p style="text-align:center;">This text needs to be centered!</p>
<style>
p { text-align:center; }
</style>
p { text-align:center; }
</style>
<style>
.center { text-align: center; }
</style>
.center { text-align: center; }
</style>
Comment