• Post category:HTML

Easy Way to Center Any Content in HTML by Using the center Tag

Center Tag in HTML

There are many ways to align the center of your content in CSS but there is only one way to do it in HTML. The center tag is used to align our HTML content, i.e. images, texts, videos, etc., in the web page’s center. If we use this tag, the content will appear in our center on all devices. This tag supports all elements, which means we can use any part inside the <center> tag. We cannot use attributes for this tag because this tag does not support any details.

Syntax:

<center>
   Your content
<center>

Ex:

<div styles = "border: 2px solid black">
<center>
<p>Welcome to Wonder Develop</p>
</center>
</div>
  1. In the above code, we have created a <div> tag inside it we have <center> and <p> tags.
  2. If I want to center the <p>, so we have created a center tag inside the <div> and outside the <p>.
  3. See the output, the <p> tag content is centered on the box.

Output:

center tag in html

 

 

Leave a Reply