How to use center tag to center text or images in HTML

<center>tag

The <center>tag (center tag) is a container element and is used to align text or images in the center of the web page. This tag is especially useful for center aligning images because we cannot do it using the <img>tag. The syntax for using this tag is as follows:

Syntax: <center>TEXT OR IMAGE(specified by using the IMG tag)</center>

Observe and try the following source code and see its effect in a web browser.
<html>
<head>
<title>Centering the Image</title></head>
<body>
<center><img src=”elephant.jpg”></center>
</body>
</html>

Use of<center>tag in sample code
Use of <center>tag in sample code
Effect of the<center>tag as seen in a web browser
Effect of the <center>tag as seen in a web browser

Leave a Comment