In HTML5, you can use the align attribute to set the title to be centered. This attribute is used to specify the horizontal alignment of the content in the title element. When the attribute value is set to "center", it means that the title will be displayed in the center. The syntax is: "
title
".
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
html5How to set the title to be centered
If you want to center the title in html, you can use the align attribute.
The align attribute can set the horizontal alignment of the content of the specified element.
The syntax is as follows:
<h1 align="center">标题</h1>
The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <h1 align="center">这是一段标题</h1> </body> </html>
Output result:
Recommended tutorial: "html video tutorial》
The above is the detailed content of How to set the title to be centered in html5. For more information, please follow other related articles on the PHP Chinese website!