1: First introduction to html
<html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
Example explanation
Text description between and Page
The text between
and is visible Page contentThe text between
and
The text between is displayed as a paragraph1.1HTML is a language used to describe web pages.
HTML refers to HyperTextMarkupLanguage
HTML is not a programming language, but a markup language
Markup language is a set of markup tags
HTML uses markup tags to describe web pages
1.2HTML markup tags are often called HTML tags (HTML tag).
HTML tags are keywords surrounded by angle brackets, such as
HTML tags usually appear in pairs, such as and < ;/b>
The first tag in the tag pair is the start tag, and the second tag is the end tag
The start and end tags are also called open tags and closing tags
1.3HTML link
HTML link is defined through the tag.
<html> <body> <a href="http://www.w3school.com.cn"> This is a link</a> </body> </html>
Note: Specify the link address in the href attribute.
1.4HTML images
HTML images are defined through the tag.
<html> <body> <img src="/i/eg_w3school.gif" width="300" height="120" /> </body> </html>
Note: The name and dimensions of the image are provided as attributes.
2: html attributes
HTML tags can have attributes. Attributes provide more information about HTML elements.
Attributes always appear in the form of name/value pairs, such as: name="value".
Attributes are always specified in the opening tag of an HTML element.
2.1 Attribute Example
HTML links are defined by the tag. The link's address is specified in the href attribute.
More HTML attribute examples
Attribute example 1:
TIY: Center the title
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "m.sbmmt.com/TR/html4/loose.dtd"> <html> <body> <h1 align="center">This is heading 1</h1> <p>上面的标题在页面中进行了居中排列。上面的标题在页面中进行了居中排列。上面的标题在页面中进行了居中排列。</p> </body> </html>
Attribute example 2:
Defines the body of the HTML document. has additional information about the background color.TIY: Background color
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta http-equiv="Content-Language" content="zh-cn" /> </head> <body bgcolor="yellow"> <h2>请看: 改变了颜色的背景。</h2> </body> </html>
Attribute example 3: