XHTML Title Overview
When we write Word documents, we often use titles, such as "Chapter 1", "1.2.1", etc. There is also the concept of title in XHTML syntax. Six levels of headings are defined in XHTML, from
The use of titles
In XHTML documents, titles are very important. Search engines use titles to index the structure and content of your web pages. We must be good at using titles to identify our document hierarchy.
Among the titles, the first level titles are the highest, and then decrease in sequence. Generally speaking, in XHTML documents, the title applies to the following places in the document (within the
Some suggestions for using titles
Since h1 represents the core content of the entire page, generally h1 can only appear once (this is not absolutely the case, but it must not appear multiple times) and used in the most emphasized part of the article. Therefore, for specific content pages, h1 is often used in article titles to highlight the importance of the article, such as this site:
Whether h1 will be used in the website title (website logo) at this time will depend on the actual situation.
Title usage practice
Open our learning document 1.html file with an editor, copy the above
Save and open the 1.html file with a browser (if it is already open, click the browser refresh button to reload the document, the same below, no further description), you can view the effect of the title tag as follows:
As you can see from the example, the browser will automatically form a line break for a title (each title has its own line).
Paragraph p tag
In XHTML, paragraphs are defined through the
In actual production work, we use
paragraph tags extensively.
Line break
In XHTML documents, the title or paragraph tag only provides a line break mark. If we need a blank line or multiple line breaks, we need Newline tag
. In XHTML, hitting the Enter key to break a new line when editing Word is invalid, and the browser will ignore the new line gap generated in this way.
Example:
Since the line break tag only informs the browser that a line break is needed in this place without any substantive content, this tag does not appear in pairs, and a
only breaks the line once. If multiple line breaks are needed, please enter Multiple
tags.
If the
tag is inserted into
or
?
Although we can still achieve line breaks using
, that is the result of the browser being compliant with the HTML4.0 specification.
In the XHTML specification, for tags that are not paired, you only need to add a space after the end of the content, and then use /> to close the tag, such as
and and other tags.
So
instead of
or
.