Home >Web Front-end >HTML Tutorial >HTML title summary recommendations
This time I will bring you a summary and recommendation of HTML titles. What are the precautions of HTML titles? Here are practical cases, let’s take a look.
HTML: Title
Heading is defined through tags such as 4a249f0d628e2318394fd9b75b4636b1 - 4e9ee319e0fa4abc21ff286eeb145ecc.
<h1> 定义最大的标题。<h6> 定义最小的标题。 <h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3>
Tip: The browser will automatically add blank lines before and after the title. h1 serves as the main heading (the most important), followed by h2 (the next most important), then h3, and so on. Tip: By default, HTML will automatically add an extra blank line before and after block-level elements, such as paragraphs and heading elements. 4a249f0d628e2318394fd9b75b4636b1 - 4e9ee319e0fa4abc21ff286eeb145ecc The align attribute is deprecated in HTML4/5. Please use CSS instead. The title supports event attributes and global attributes
Set title alignment:
CSS syntax: 43b22804203b6045a31eedffd0845461
Method 1:
<!DOCTYPE html> <html> <body> <h1 style="text-align:center">This is heading 1</h1> <h2 style="text-align:left">This is heading 2</h2> <h3 style="text-align:right">This is heading 3</h3> <h4 style="text-align:justify">This is heading 4</h4> </body> </html>
Method 2:
<!DOCTYPE html> <html> <head> <style> h1 {text-align:center} h2 {text-align:left} h3 {text-align:right} </style> </head> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> </body> </html>
HTML: Horizontal line
231a563c997aa9e3e0ae614bd16728b0 tag is created in the HTML page horizontal line. The
hr element can be used to separate content.
<p>This is a paragraph</p> <hr /> <p>This is a paragraph</p> <hr />
e388a4556c0f65e1904146cc1a846beeThis is a paragraph94b3e26ee717c64999d7867364b1b4a3Tip: Using horizontal lines (f32b48428a809b51f04d3228cdf461fa tags) to separate sections in an article is one way (but not the only way). HTML5 does not support the f32b48428a809b51f04d3228cdf461fa align attribute. Please use CSS instead.
In HTML 4.01, the align attribute of f32b48428a809b51f04d3228cdf461fa has been deprecated.
align attribute specifies the alignment of horizontal lines.
Note: Unless the width attribute is set to less than 100%, the align attribute will have no effect.
CSS syntax (IE and Opera): b6b08834a2c71e4c4f5c07ba37a5f4e5
CSS syntax (Firefox, Chrome, and Safari): aa65c34d894985fb7ca7ec3b33c47886
CSS syntax (cross-browser): 7ddfdf383f176d5259b96af8417ef01d
Attribute Value Descriptioncss syntax formatc98f903ba699f243c047ae970b8a1da0
align left
center
right HTML5 is not supported. HTML 4.01 is deprecated. Specifies the alignment of the f32b48428a809b51f04d3228cdf461fa element
noshade noshade is not supported by HTML5. HTML 4.01 is deprecated. Specifies that the color of the f32b48428a809b51f04d3228cdf461fa element should be rendered as a solid color.
size pixels HTML5 is not supported. HTML 4.01 is deprecated. Specifies the height of the f32b48428a809b51f04d3228cdf461fa element.
width pixels
% HTML5 is not supported. HTML 4.01 is deprecated. Specifies the width of the f32b48428a809b51f04d3228cdf461fa element.
<!DOCTYPE html> <html> <body> <p>This is some text. This is some text. This is some text.</p> <hr style="width:50%;text-align:left;margin-left:0"> <p>This is some text. This is some text. This is some text.</p> </body> </html>
HTML: Comments
You can insert comments into HTML code, which can improve its readability and make the code easier to understand. The browser ignores comments and does not display them.
The comment is written like this:
cf2a8215cfeca7c74714a9990fb8e262
Comment: The last two forward slashes (/ /) is the JavaScript comment symbol. This ensures that JavaScript will not execute the --> tag.
In addition to their obvious role in source documents, many web servers also use comments to implement features unique to document server software. These servers can scan documents for specific character sequences within traditional HTML/XHTML comments and then take appropriate actions based on commands embedded in the comments. These actions may be as simple as including text from other files (so-called server-inside include), or they may be as complex as executing other commands to dynamically generate the content of the document.
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Detailed explanation of examples of HTML text formatting
What are the list tags in html?
The basics of HTML editing (a must-read for beginners)
The above is the detailed content of HTML title summary recommendations. For more information, please follow other related articles on the PHP Chinese website!