Getting started is simple HTML code

Font code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-CN"http://zzdxjyzd.com xml:lang="zh-CN" xmlns="

<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
</head>
<body>

<H1> My first title </ h1>

<P> My first paragraph. </ P>

</body>
</html>


The following is the renderings Oh! !


——————————————————————————————————————————————————————————
--------------------------------------------------------------------------------

The following teach you to understand what is meant by knowledge of HTML elements


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

HTML documents as HTML elements (element) to define.

Nested HTML elements


Most HTML elements can be nested (can contain other HTML elements).

HTML document consists of nested HTML elements.


--------------------------------------------------------------------------------


HTML document example
<html>

<body>
<the p-> This is my first paragraph </ the p->
</ body>

<html>


The example above contains three HTML elements.


--------------------------------------------------------------------------------


Examples explain
<p> element:
<p> This is my first paragraph </ p>


<p> element defines a paragraph in the HTML document
The element has a start tag <p> and an end tag </ p>
this element is: This is my first paragraph


<body> element:
<body>
<the p-> This is my first paragraph </ the p->
</ body>


<body> element defines the body of the HTML document (body)
The element has a start tag <body> and an end tag </ body>
this element is another HTML element (<p>)


<html> element:
<html>
<body>
<the p-> This is my first paragraph </ the p->
</ body>
</ HTML>


<html> element defines the entire HTML document
The element has a start tag <html> and an end tag </ html>
this element is another HTML element (<body>)


--------------------------------------------------------------------------------


Do not forget the end tag


Even if you forget to write the closing tag, most browsers can still display correctly your HTML:

<p> This is a paragraph
<p> This is a paragraph


Although most browsers can display cases on the right, but you should not rely on fault-tolerance capabilities of the browser. Forget to write the end of the label may cause unexpected results or errors.

Note: missing end tags in future versions of the HTML is not allowed.


--------------------------------------------------------------------------------


Empty HTML elements


HTML elements without content are called empty elements (empty element). Empty elements to end the start tag and an end.

<br> is not over empty element tag (which defines the line break).

In XHTML, XML, and future versions of HTML, all elements must be properly closed.

Close empty elements correct way is to add a backslash start tag, like <br /> so.

Even if the browser can still handle <br>, but written as <br /> This form of better withstand future challenges.

Guess you like

Origin www.cnblogs.com/dakunqq/p/11443239.html