Properties and Values
1. function
Used to modify elements
Ex: Aligns the text of the P tag horizontally to the center
<p>hello world</p>
2. Grammar
1. Declaration of attributes must be in the start tag
< tag attributes ></tags >
2. Attributes can have values, attributes, and properties that are worthwhile to behave = "value"
< tag attribute = "value" ></tag >
3. Multiple attributes and values are allowed in an element, separated by spaces, and ranked in no particular order
< Tag properties = "Value" property = "value" ></tag >
Ex: Set the Align property to a pair of P tags with a value of center
<p align= "center" ></p>
3. Standard attributes
Each element has its own unique properties. Some properties are supported by all elements, called standard properties
1. ID: The unique identifier of the element in the page
2. Title: The text content that is prompted when the mouse moves into the element
3, Class: element-referenced classes selector (style dependent)
4. Style: an inline style defined by an element (related to a style)
Comments
1. The function is visible under the editing document, the content that does not display when the browser presents the page
2. Grammar
<!--comment Content--
Attention
1. Comments cannot be nested <!--<!--This is a comment-->--> error
2. Comments cannot be located in <> <p<!--comment-->> error
Document structure
1. Document type declaration function: Specifies the HTML version and style used
<!doctype html>
2. HTML page
Located under DOCTYPE
Contains the following two child elements
1.
Page Header Content
2.<body></body>
Web page body
3. html page-
2. Use
Define page Global Information
2. Contains the following sub-elements
1. <title> Title </title> page Title
2. <meta> define page meta-data
<meta charset= "Utf-8" >
Note: Set Web page encoding while ensuring that the encoding of the Web page file is also utf-8
4, HTML page-<body> The main content of the page display
Property:
1, text control the color of Web page text
2, bgcolor control the background color of the Web page
Exercise: Create a document, change the suffix to. html, set the title to "My first HTML Exercise", the page's encoding format is uft-8, the page displays the text "My first HTML exercise content", the black background color, the yellow text color
<!DOCTYPE HTML><HTML> <Head> <title>My first HTML exercise</title> <MetaCharSet= "Utf-8"> </Head> <Bodytext= "Yellow"bgcolor= "BLACK"><PAlign= "Center">My first HTML practice content</P> </Body></HTML>
First HTML document