HTML学习笔记(一)


1. HTML

  • HTML: 超文本标记语言(Hyper Text Markup Language)
    (超文本标记语言意思就是可以包含的内容不止文字,还可以包含图片,链接等非文字语言。
    The HyperText part refers to the fact that HTML allows you to create links that allow visitors to move from one page to another quickly and easily. A markup language allows you to annotate text, and these annotations provide additional meaning to the contents of a document.
    )
  • XHTML: 可扩展超文本标记语言(EXtensible Hyper Text Markup Language)
    (表现方式与HTML类似,不过语法更加严格)
  • HTML5: HTML的第五次重大修订(第5个版本)

2. HTML是用来干什么的?

  • 它的作用:描述浏览器的网页结构。
    (使浏览器知道在页面的某个位置放置某个标签或元素,实现某个功能,以此来让浏览器展现出我们想要的效果)

3. HTML的语言组成

  • tags:

Tags act like containers. They tell you something about the information that lies between their opening and closing tags.

一般而言,标签是成对存在的,包含opening tag和closing tag。
  例如:opening tag <p> 和 closing tag </p>
也有单独存在的,比如换行符 <br> 等。

  • attribute:

Attributes provide additional information about the contents of an element. They appear on the opening tag of the element and are made up of two parts: a name and a value, separated by an equals sign.

举个例子:

<!--
	<p lang = "en-us">这个为opening tag。
		The characters in the brackets indicate the tag's purpose. 
		For example, in the tags above the p stands for paragraph.
	</p>这个为closing tag。
	The closing tag has a forward slash(/) after the the < symbol.
	
	lang 为 Attribute Name:
		The attribute name indicates what kind of extra information you are supplying about the element's content. 
		It should be written in lowercase.
		(lang is used to indicate the language used in this element.)
		
	en-us为 Attribute Value:
		The value is the information or setting for the attribute.
		It should be placed in double quotes.
		Different attributes can have different values.
		(en-us, The value of this attribute on this page specifies it is in US English.)
-->
<p lang = "en-us">Paragraph in English</p>

4. HTML的结构

<!DOCTOPYE html>
<html lang="zh-CN"> 
<head> 
	<meta charset="UTF-8"> 
	<title>标题</title> 
	<meta name="keywords" content="关键字" /> 
	<meta name="description" content="网页描述" /> 
</head> 
<body> 
	正文内容
</body> 
</html> 
  • <!DOCTOPYE html>

    DOCTOPYE(Document Type Declaration)用来声明文档
    <!DOCTOPYE html>: inform a website visitor’s browser that the document being rendered is an HTML document.

  • <html> </html>
    <html> 表示页面编写的代码都是 HTML 代码。它是成对出现的标签,直到 </html> 结束。定义html文档的整体。

  • <html lang=“zh-CN”>
    It is used to indicate the language used in this element. zh-CN就是中文。

  • <head></head>
    This contains information about the page (rather than information that is shown within the main part of the browser window). You will usually find a <title> element inside the <head> element.

  • <meta charset=“UTF-8”>
    规定 HTML 文档的字符编码。一般情况下,对于中文网页需要使用 <meta charset=“UTF-8”> 声明编码,否则会出现乱码。

  • <title>标题</title>
    The contents of the <title> element are either shown in the top of the browser, above where you usually type in the URL of the page you want to visit, or on the tab for that page (if your browser uses tabs to allow you to view multiple pages at the same time).

  • <meta name=“keywords” content=“关键字” /> <meta name=“description” content=“网页描述” />
    为搜索引擎提供的关键字列表和主要内容。

  • <body>正文内容</body>
    Everything inside this element is shown inside the main browser window.


5. HTML注释

html注释代码分为单行注释和多行注释,都是使用 “<!–文本部分 -->” 语法进行注释。

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>html中的注释</title>
</head>
<body>  
    <!--这是单行注释 -->
    <!-- 
    	这是多行注释
    	这是多行注释 
    -->
    <h1>这是文章标题</h1>
    <p>这是一个段落</p>
</body>
</html>

6. 显示特殊符号

在HTML中,如果我们想要显示一些特殊符号,比如标签<br>,将它显示在页面的内容上,其中<会被当做标签的开始,导致无法显示于页面中。
那么,我们用什么方法实现呢?
我们可以通过使用字符实体解决这个问题!

HTML 原代码显示结果描述
&lt;<小于号或显示标记
&gt;>大于号或显示标记
&amp;&可用于显示其它特殊字符
&quot;"引号
&times;×乘号
&divide;÷除号
&ensp;半个空白位
&emsp;一个空白位
&nbsp; 不断行的空白

HTML学习笔记-----HTML基础知识(二)

  • 9
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值