HTML Center Tag

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>…

1 min read

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:-

Khushal

Welcome to my corner of the web! I'm Khushal Tank, a passionate web developer and the author behind MyProgramming.com. With a robust background in PHP, Webflow, HTML, CSS, and JavaScript, I've dedicated myself to crafting seamless, interactive, and visually appealing websites.

Leave a Reply

Your email address will not be published. Required fields are marked *