<center> HTML Tag

In this article we will discuss about center tag of HTML.
  • 2852

Center tag of HTML is use for putting or place anything in center of the page. To use the center tag we write this:<center></center>. It is the syntax of center tag. In between this tag we write the code which we want to put in center.

Example 1

<html>
<head>
    <title></title>
</head>
<body>
<p>You are not in
center.</p>
<
center>You are in center.</center>
<p>Again you are not in
center.</p>
</body>
</html>

Output

You are not in center.

You are in center.

Again you are not in center.

Here you are in center coming in the center tag of HTML. In this Example we use center tag for a text. In this two sentences are normal but one is centerd. 

Example 2

<html>
<head>
    <title></title>
</head>
<body>
    <input id="Button1" type="button" value="Left" />
    <center>
        <input id="Button2" type="button" value="center" />
    </center>
    <input id="Button3" type="button" value="Left" />
</body>
</html>

 

Output

In this example we use three Button. Out of three two are normal but one is centerd.

Ask Your Question 

Got a programming related question? You may want to post your question here
 
© 2020 DotNetHeaven. All rights reserved.