<metacharset="utf-8"><metaname="author"content="Chris Mills"><metaname="description"content="The MDN Web Docs Learning Area aims to provide
complete beginners to the Web with all they need to know to get
started with developing web sites and applications.">
<blockquotecite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote"><p>The <strong>HTML <code><blockquote>code> Elementstrong> (or <em>HTML Block
Quotation Elementem>) indicates that the enclosed text is an extended quotation.p>blockquote>
1
2
3
4
5
行内引用 (不会跳转)
浏览器默认将其作为普通文本放入引号内表示引用
<p>The quote element — <code><q>code> — is <qcite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q">intended
for short quotations that don't require paragraph breaks.q>p>
1
2
3
4
引文
<p>According to the <ahref="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote"><cite>MDN blockquote pagecite>a>:
p>
1
2
3
4
5
例子
<p>你好!欢迎访问我的激励网页!<ahref="http://www.brainyquote.com/quotes/authors/c/confucius.html"><cite>孔子cite>a>曰:p><blockquotecite="https://zh.wikipedia.org/zh-hans/孔子"><p>譬如为山,未成一篑,止,吾止也。譬如平地,虽覆一篑,进,吾往也。p>blockquote><p>要保持乐观,<qcite="http://www.affirmationsforpositivethinking.com/">不要说泄气的话q>。(源自 <ahref="http://www.affirmationsforpositivethinking.com/"><cite>Affirmations for Positive Thinkingcite>a>。)p>
1
2
3
4
5
6
只有用a标签才会跳转
缩略语
另一个你在 web 上看到的相当常见的元素是它常被用来包裹一个缩略语或缩写,并且提供缩写的解释(包含在title属性中)。让我们看看下面两个例子:
<timedatetime="2016-01-20">20 January 2016time><timedatetime="2016-01">January 2016time><timedatetime="01-20">20 Januarytime><timedatetime="19:30">19:30time><timedatetime="19:30:01.856">19:30:01.856time><timedatetime="2016-01-20T19:30">7.30pm, 20 January 2016time><timedatetime="2016-01-20T19:30+01:00">7.30pm, 20 January 2016 is 8.30pm in Francetime><timedatetime="2016-W04">The fourth week of 2016time>
<imgsrc="images/dinosaur.jpg"><imgsrc="images/dinosaur.jpg"alt="The head and torso of a dinosaur skeleton;
it has a large head with long sharp teeth"><imgsrc="images/dinosaur.jpg"alt="一只恐龙头部和躯干的骨架,它有一个巨大的头,长着锋利的牙齿。"width="400"height="341"><imgsrc="images/dinosaur.jpg"alt="一只恐龙头部和躯干的骨架,它有一个巨大的头,长着锋利的牙齿。"width="400"height="341"title="A T-Rex on display in the Manchester University Museum">
<picture><sourcetype="image/svg+xml"srcset="pyramid.svg"><sourcetype="image/webp"srcset="pyramid.webp"><imgsrc="pyramid.png"alt="regular pyramid built from four equilateral triangles">picture>
1
2
3
4
5
6
7
8
自适应图片
根据设备大小选择显示图片的大小
<imgsrcset="elva-fairy-320w.jpg 320w,
elva-fairy-480w.jpg 480w,
elva-fairy-800w.jpg 800w"sizes="(max-width: 320px) 280px,
(max-width: 480px) 440px,
800px"src="elva-fairy-800w.jpg"alt="Elva dressed as a fairy">
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
相同尺寸不同分辨率
<imgsrcset="elva-fairy-320w.jpg,
elva-fairy-480w.jpg 1.5x,
elva-fairy-640w.jpg 2x"src="elva-fairy-640w.jpg"alt="Elva dressed as a fairy">
1
2
3
4
5
6
7
8
9
picture
<picture><sourcemedia="(max-width: 799px)"srcset="elva-480w-close-portrait.jpg"><sourcemedia="(min-width: 800px)"srcset="elva-800w.jpg"><imgsrc="elva-800w.jpg"alt="Chris standing up holding his daughter Elva">picture>
每个source标签页含有一个 type 属性,这个属性是可选的,但是建议你添加上这个属性 — 它包含了视频文件的 MIME types ,同时浏览器也会通过检查这个属性来迅速的跳过那些不支持的格式。如果你没有添加 type 属性,浏览器会尝试加载每一个文件,直到找到一个能正确播放的格式,这样会消耗掉大量的时间和资源。
这些元素是用来嵌入多种类型的外部内容的通用嵌入工具,其中包括像 Java 小程序和 Flash,PDF(可在浏览器中显示为一个 PDF 插件)这样的插件技术,甚至像视频,SVG 和图像的内容!
但是基本不太使用了
object嵌入pdf
<objectdata="mypdf.pdf"type="application/pdf"width="800"height="1200"typemustmatch><p>You don't have a PDF plugin, but you can <ahref="myfile.pdf">download the PDF file.a>p>object>
<imgsrc="equilateral.svg"alt="triangle with all three sides equal"height="87px"width="100px"/>
1
2
3
4
5
6
7
旧版本浏览器:
<imgsrc="equilateral.png"alt="triangle with equal sides"srcset="equilateral.svg">
1
2
3
4
嵌入SVG
<iframesrc="triangle.svg"width="500"height="500"sandbox><imgsrc="triangle.png"alt="Triangle with three unequal sides"/>iframe>
1
2
3
4
表格
<table><tr><td>Hi, I'm your first cell.td><td>I'm your second cell.td><td>I'm your third cell.td><td>I'm your fourth cell.td>tr><tr><td>Second row, first cell.td><td>Cell 2.td><td>Cell 3.td><td>Cell 4.td>tr>table>
<table><caption>Dinosaurs in the Jurassic periodcaption>
...
table>
1
2
3
4
5
6
表格结构化
<table><caption>How I chose to spend my moneycaption><thead><tr><th>Purchaseth><th>Locationth><th>Dateth><th>Evaluationth><th>Cost (€)th><tr/>thead><tfoot><tr><tdcolspan=4>SUMtd><td>118td>tr>tfoot><tbody><tr><td>Haircuttd><td>Hairdressertd><td>12/09td><td>Great ideatd><td>30td>tr><tr><td>Lasagnatd><td>Restauranttd><td>12/09td><td>Regretstd><td>18td>tr><tr><td>Shoestd><td>Shoeshoptd><td>13/09td><td>Big regretstd><td>65td>tr><tr><td>Toothpastetd><td>Supermarkettd><td>13/09td><td>Goodtd><td>5td>tr>tbody>table>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
表单
HTML 表单是用户和 web 站点或应用程序之间交互的主要内容之一。它们允许用户将数据发送到 web 站点。大多数情况下,数据被发送到 web 服务器,但是 web 页面也可以自己拦截它并使用它.
HTML 表单是由一个或多个小部件组成的。这些小部件可以是文本字段 (单行或多行)、选择框、按钮、复选框或单选按钮。
表单将包含三个文本字段和一个按钮。我们向用户询问他们的姓名、电子邮件和他们想要发送的信息。点击这个按钮将把他们的数据发送到一个 web 服务器。
<formaction="/my-handling-form-page"method="post"><div><labelfor="name">Name:label><inputtype="text"id="name"name="user_name">div><div><labelfor="mail">E-mail:label><inputtype="email"id="mail"name="user_email">div><div><labelfor="msg">Message:label><textareaid="msg"name="user_message">textarea>div><divclass="button"><buttontype="submit">Send your messagebutton>div>form>
<form><fieldset><legend>Fruit juice sizelegend><p><inputtype="radio"name="size"id="size_1"value="small"><labelfor="size_1">Smalllabel>p><p><inputtype="radio"name="size"id="size_2"value="medium"><labelfor="size_2">Mediumlabel>p><p><inputtype="radio"name="size"id="size_3"value="large"><labelfor="size_3">Largelabel>p>fieldset>form>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
label
标签与 通过他们各自的for 属性和 id 属性正确相关联(label 的 for 属性和它对应的小部件的 id 属性)
<inputtype="text"id="comment"name="comment"value="I'm a text field"><inputtype="password"id="pwd"name="pwd"><inputtype="hidden"id="timestamp"name="timestamp"value="1286705410">
<form><labelfor="choose">Would you prefer a banana or a cherry?label><inputid="choose"name="i_like"requiredpattern="banana|cherry"><button>Submitbutton>form>
<form><div><labelfor="choose">Would you prefer a banana or a cherry?label><inputid="choose"name="i_like"requiredminlength="6"maxlength="6">div><div><labelfor="number">How many would you like?label><inputtype="number"id="number"name="amount"value="1"min="1"max="10">div><div><button>Submitbutton>div>form>
<formaction="http://foo.com"method="get"><div><labelfor="say">What greeting do you want to say?label><inputname="say"id="say"value="Hi">div><div><labelfor="to">Who do you want to say it to?label><inputname="to"id="to"value="Mom">div><div><button>Send my greetingsbutton>div>form>
<formaction="http://foo.com"method="post"><div><labelfor="say">What greeting do you want to say?label><inputname="say"id="say"value="Hi">div><div><labelfor="to">Who do you want to say it to?label><inputname="to"id="to"value="Mom">div><div><button>Send my greetingsbutton>div>form>
<formmethod="post"enctype="multipart/form-data"><div><labelfor="file">Choose a filelabel><inputtype="file"id="file"name="myFile">div><div><button>Send the filebutton>div>form>