基础HTML标签
基础HTML标签
只有
<body>...<body>
之间的内容会被显示出来。Only the content inside the <body> section is displayed in a browser.
标签 | 描述 |
---|---|
<!DOCTYPE> |
定义文档格式 defines file type |
<html> |
定义HTML文档 This is the root element of an HTML page. The HTML document itself begins with <html> and ends with </html>. |
<!DOCTYPE html> |
所有HTML文档必须使用的定义 |
<head> |
A container for all the head elements (title, scripts, styles, meta information, and more) --> contains meta information about the document |
<title> |
定义文档标题,标题可以用来呈现文档结构 specifies a title for the document |
<body> |
定义文档的主体 contains the visible page content |
<h1> to <h6>
|
定义 HTML 标题 defines headings |
<p> |
定义段落 defines a paragraph |
<br> or <br />
|
定义简单的折行,前者适用于HTML,严格的写法为后者,XHTML无法显示前者 Inserts a single line break |
<!--...--> <!-- 这是一个注释 -->
|
定义注释 |
<hr> |
定义简单的水平线、分割线 It defines a thematic break in an HTML page, and is most often displayed as a horizontal rule. |
The HTML <head>
element has nothing to do with HTML headings.
The <head>
element is a container for metadata. HTML metadata is data about the HTML document. Metadata is not displayed.
Note: Metadata typically define the document title, character set, styles, links, scripts, and other meta information.
HTML Comment Tags
<!-- This is a comment -->
<p>This is a paragraph.</p>
<!-- Remember to add more information here -->
Comments are also great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for errors:
<!-- Do not display this at the moment
<img border="0" src="pic_trulli.jpg" alt="Trulli">
-->
关于HTML标签
- HTML tags normally come in pairs like <p> and </p>
- The first tag in a pair is the start tag/opening tag, the second tag is the end tag/closing tag
- The end tag is written like the start tag, but with a forward slash inserted before the tag name
浏览器的作用是什么?
读取并显示HTML文档 The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them.
基本HTML编辑器
- 一般可使用Notepad 记事本(PC) or TextEdit (Mac)
- 三种专门用于编辑 HTML 的 HTML 编辑器:
Adobe Dreamweaver
Microsoft Expression Web
CoffeeCup HTML Editor - 推荐使用Notepad++
- W3Schools online editor (https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default)
保存记事本要注意格式和语言 Name the file "index.htm" or "index.html" and set the encoding to UTF-8 (which is the preferred encoding for HTML files).
You can use either .htm or .html as file extension. There is no difference, it is up to you.