Computer >> Computer tutorials >  >> Programming >> Javascript

How to center text in HTML?


The HTML <center> tag is used for centering the content enclosed with this tag.

Note − This tag is now deprecated.

Example

You can try to run the following code to center text in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML center Tag</title>
   </head>
   <body>
      <center>This text is centered</center>
      <p>This is a normal text.</p>
   </body>
</html>