Web front-end basis (a) - HTML Introduction

Introduction to HTML

HTML (English: HyperText Markup Language, referred to as: HTML) is a standard for creating a web page markup language.

Extension of HTML documents: .html and .htm, there is no difference between the two suffix, can be used.

HTML Examples

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title> HTML Examples </ title> 
</ head>
<body>
  <h1 of> My first title </ h1 of>
  <P> My first paragraph. </ P>
</ body>
</ HTML>

Analysis examples

  • <! DOCTYPE html>  declaration for the HTML5 document
  • <html>  element is the root element of an HTML page
  • <head>  element of the document contains the element (Meta) data, such as the  <meta charset = "utf-8 "> custom page coding format  UTF-. 8 .
  • <title>  element describes the document title
  • <body>  element contains the visible page content
  • <h1>  element defines a headline
  • <p>  element defines a paragraph

HTML tags

Commonly referred to as HTML markup tags HTML tags (HTML tag).

  • HTML tags by angle brackets enclosing keywords, such as <html>
  • HTML tags are usually in pairs , such as <b> and </ b>
  • The label on the label is the first start tag , the second tag is the end tag
  • Start and end tags are also called opening tags and closing tags
  Example: <tag> SUMMARY </ tab>

HTML elements

"HTML tags" and "HTML elements" are often described the same meaning.

But strictly speaking, an HTML element contains the start tag and end tag, the following examples:

HTML elements:

  <P> This is a paragraph. </ P>

Web Browser

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

Browser does not directly display the HTML tags, but you can use labels to determine how to render the HTML page content to the user:


HTML page structure

The following is a visual HTML page structure:

 

 Note: Only the <body> area (white part?) Will be displayed in the browser??.


HTML version

From the early days after the birth of the Internet, there have been many versions of HTML:

版本 发布时间
HTML 1991
HTML+ 1993
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 1.0 2000
HTML5 2012
XHTML5 2013


<! DOCTYPE> declaration

<! DOCTYPE> declaration helps the browser to display the page correctly.

There are many different files on the network, if we can correct statement HTML version of the browser will be able to display the web page content correctly.

doctype 声明是不区分大小写的,以下方式均可:

<!DOCTYPE html>
<!DOCTYPE HTML>
<!doctype html>
<!Doctype Html>

通用声明

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">

查看完整网页声明类型 DOCTYPE 参考手册


中文编码

目前在大部分浏览器中,直接输出中文会出现中文乱码的情况,这时候我们就需要在头部将字符声明为 UTF-8 或 GBK。

HTML 实例

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="UTF-8"> 
    <title>页面标题</title> 
</head> 
<body> 
    <h1>我的第一个标题</h1> 
    <p>我的第一个段落。</p> 
</body> 
</html>

HTML 编辑器推荐

可以使用专业的 HTML 编辑器来编辑 HTML,个人推荐几款常用的编辑器:

Guess you like

Origin www.cnblogs.com/fzsz086/p/11964856.html
Recommended