Home > Web Front-end > Front-end Q&A > How to set the title to be centered in html5

How to set the title to be centered in html5

WBOY
Release: 2021-12-31 11:26:07
Original
14985 people have browsed it

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

".

How to set the title to be centered in html5

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>
Copy after login

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>
Copy after login

Output result:

How to set the title to be centered in html5

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template