Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points of HTML tag syntax

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "what are the knowledge points of HTML tag grammar". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this article "what are the knowledge points of HTML tag grammar" can help you solve the problem.

I. tag grammar

1. All tags must be expanded with angle brackets, for example,.

2. There are closed type tags and non-closed type tags.

2.1. Closed types, also known as double tags, must appear in pairs; grammatical rules: text content; different tags determine the different forms of "text content"; common closed type tags are:

2.2. Unclosed types, also known as single tags or empty tags; syntax rules: or common unclosed type tags are:

The difference between a closed type and an unclosed type tag depends on whether the tag appears in a pair or individually.

3. Label nesting

Tags can be nested within each other to form complex grammatical structures. Simple examples are as follows:

4. Tag attributes, which refer to the content that appears in the opening tag and are used to modify elements, such as

Standard attributes: common attributes that every element is born with. Common standard attributes are:

Id: defines a unique identity for each label

Title: prompt text

Class: style dependent, class style

Style: style dependent, inline style

Now you can write a simple tag with the editor and set the id attribute of the tag to myDIv. (attribute naming method: hump naming, which will be shared with you later)

Practice: the first step: define a tag div, that is

Step 2: add the id attribute, that is

Question: what if there are multiple attribute values? How to add attribute values is coding specification?

Answer: if it is multi-attribute, then continue to write directly after the previous attribute value, do not need to use "," or; "separate, just write it! And, if you rank multiple attributes in no particular order, take a chestnut:

II. Document structure

1. Document type declaration: that is, the HTML version and style used in the declaration. The use in HTML5 is declared as:

2. Html page

2.1. document root element, each document has one and only one pair of root elements, html

2.2. Inside the root element, it contains two pairs of child elements

2.2.1. Head: the high-quality content of the page. The global information of the page is defined as follows:

The title of the page is the name displayed on the address of the page

Declare metadata (encoding, keywords, description), the most important search engine SEO is mainly to write this part; at the same time, you can also define some web page properties, such as Chinese display

Declare the internal style sheet and declare the style used on the current web page. The style definition in this way can only be applied to the current page. Other pages cannot use the style defined here.

Introduce external stylesheets and externally defined styles. As long as this page wants to use an external stylesheet, it can be used directly. This kind of stylesheet definition can be used to make up for the defects that can not be shared above. Yes, the code achieves the advantage of reuse.

Define or introduce script files, mainly to introduce some js scripting languages to complete the interaction required by this page

2.2.2, body: the main content of the page, any tag, may appear in the body; it is also a tag, it can also define its own attributes, such as the background of the page is green, then it is

3. Text markup

3.1. special text, in addition to normal text, special punctuation marks may be required under some specific circumstances. Xiaobian gives examples of the marks of several common special symbols, such as the space corresponds to "", the corresponding ">" is understood as greater than, and the copyright logo corresponds to "& copy". Here, special attention should be paid to the need for each special character. "

3.2. Text markup

3.2.1, text style

...: bold text

...: italic text

...: underline

...: delete line

...: superscript

...: subscript

3.2.2, title element, level 1-6, 6 titles nRV 1-6, of which the first level is the largest and the sixth level is the smallest.

3.2.3, paragraph elements, which provide the expression of structured text, grammar:

Note: each pair of p tags is divided into a separate paragraph, commonly used attributes:

Align: horizontal alignment. Value: left center right

4. The newline element, which implements the effect of carriage return anywhere in the code, is an unclosed type tag.

5. Horizontal lines, also known as split lines, are also unclosed type tags, commonly used attributes

Size: the thickness of a horizontal line, usually in px

5.2, width: width

5.3.The align: horizontal alignment of horizontal Lin

Color: color

6. Partition element purpose: to group elements, mostly used in layout

Block partition elements:

Inline partition elements:

Note:

Div: mainly used in layout

Span: modify the style of its internal content

7. Pre-formatting, preserving the spaces and carriage return text in the source document

8. Notes

Text that can be written in html source code but not interpreted by the browser

Syntax:

!!! Special attention: intra-line elements and block-level elements

Block-level elements: by default, block-level elements occupy a single line, and the elements are automatically wrapped before and after div, hn, hr, p and so on.

Inline elements: by default, multiple elements are on the same line and do not wrap, span, text tags. The role of the main inline elements: modify the style of the internal content.

This is the end of the introduction of "what are the knowledge points of HTML tag grammar". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report