Let’s see how to use html center tag in this blog and you can also center your content using CSS property ( text-align: center;) center.
HTML <center> Tag
Example:-
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
HTML center Tag
</title>
</head>
<body>
<h1>This is HTML center tag</h1>
<h2>Example of center tag</h2>
<center>We Learn Coding With Myprograming</center>
</body>
</html>
Output:-
Center-align text (with CSS):
Example:-
<html>
<title>Center-align text (with CSS):</title>
<head>
<style>
h1 {text-align: center;}
p {text-align: center;}
div {text-align: center;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<div>This is a div.</div>
</body>
</html>
Output:-