Introduction to HTML


HTML Example

Example

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php 中文网</title>
</head>
<body>

<h1>我的第一个标题</h1>
<p>我的第一个段落。</p>

</body>
</html>

Run Example»

Click the "Run Example" button to view Online example

Example analysis

  • ##DOCTYPE declares the document type

  • Located in the tags <html> and </html> describes the document type

  • Located in the tags <body> and </body> is a visual web page Content

  • is located in the tags <h1> and </h1> As a title use

  • is located in the tags <p> and < /p> Displayed as a paragraph


What is HTML?

HTML is a language used to describe web pages.

  • HTML refers to Hypertext Markup Language: HyperText Markup Language

  • HTML is not a programming language, but a markuplanguage

  • Markup language is a SetMarkup tag (markup tag)

  • HTML Use markup tags to describe web pages

  • HTML documents contain HTML tags and textcontent

  • HTML documents are also called web pages


HTML tag

HTML markup tag is usually called HTML tag (HTML tag).

  • ##HTML tags are keywords surrounded by

    angle brackets, such as <html>

  • ##HTML tags are usually
  • appears in pairs, such as <b> and </b>

    ##The first tag in the tag pair is

    start tag
  • , the second tag is
  • End tag

    Start and end tags are also known as

    Open tag
  • and
  • Close tag

    ##<tag>

    Content
  • </tag>
HTML Element"HTML tag" and "HTML element" usually describe the same meaning.

But strictly speaking, an HTML element contains a start tag and an end tag, as shown in the following example:

HTML Element:

<p>

This is a paragraph.

</p>

Web BrowserWeb browser (such as Google Chrome, Internet Explorer, Firefox, Safari) is used to read HTML file and display it as a web page.

The browser does not display HTML tags directly, but you can use tags to decide how to display the content of the HTML page to users:

##HTML Web page structure

The following is a visual HTML page structure:

<html>
<head>

<title> Page title</title>

</head>

<body>
<h1> This is a heading</h1>
<p>This is a paragraph. </p>
<p> This is another paragraph. </p>
</body>
</html>
lamp.jpg#<!DOCTYPE html> also describes the document in HTML5 type.
Only <body> area (white part) will be displayed in the browser.
lamp.jpg

HTML version

Since the birth of the early Internet, many HTML versions have appeared:

VersionRelease timeHTML1991HTML+1993HTML 2.01995HTML 3.21997HTML 4.011999XHTML 1.02000 HTML52012XHTML52013
#<!DOCTYPE> ; CLAIMS

<!DOCTYPE>The declaration helps browsers display web pages correctly.

There are many different files on the Internet. If the HTML version can be declared correctly, the browser can display the web page content correctly.

The doctype declaration is case-insensitive, and the following methods are available:

<!DOCTYPE html>
<!DOCTYPE HTML>

<!doctype html>

<!Doctype Html>

General declaration

HTML5

<!DOCTYPE html>
HTML 4.01

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd">

View the complete web page declaration type DOCTYPE reference manual.

Chinese encoding

Currently in most browsers, directly outputting Chinese will cause Chinese garbled characters. At this time, we need to declare the characters as UTF- in the header. 8.

HTML Example

Instance

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>页面标题</title>
</head>
<body>

<h1>我的第一个标题</h1>

<p>我的第一个段落。</p>

</body>
</html>

Run Example»
Click "Run Example" " button to view online examples