您的位置:首页 > Web前端 > HTML

学习笔记—HTML(3)

2017-12-11 11:58 218 查看
描述列表:
这些列表的目的是标记一组项目及其相关描述,例如术语和定义, 问题和答案等。

描述列表 (description list) 使用与其他列表类型不同的闭合标签— 
<dl>
;
此外,每一项都用  
<dt>
 (description
term)  元素闭合。每个描述都用 
<dd>
 (description
description) 元素闭合。让我们来完成下面的标记例子:
<dl>
<dt>soliloquy</dt>
<dd>In drama, where a character speaks to themselves, representing their inner thoughts or feelings and in the process relaying them to the audience (but not to other characters.)</dd>
<dt>monologue</dt>
<dd>In drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.</dd>
<dt>aside</dt>
<dd>In drama, where a character shares a comment only with the audience for humorous or dramatic effect. This is usually a feeling, thought or piece of additional background information.</dd>
</dl>


 浏览器的默认样式会将描述列表的描述部分(description description)渲染成和描述术语(description terms)之间有一些缩进。
如果一个块级内容(一个段落,多个段落,一个列表等)从其他地方被引用,你应该把它用
<blockquote>
元素包裹起来表示,并且在
cite
属性里用URL来指向引用的资源。

行内元素用同样的方式工作,除了使用
<q>
元素。例如,下面的标记包含了从MDN
<q>
页面的引用:
<p>The quote element — <code><q></code> — is <q cite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q">intended
for short quotations that don't require paragraph breaks.</q></p>


浏览器默认将其作为普通文本放入引号内表示引用,就像下面:

The quote element — 
<q>
 — is intended
for short quotations that don't require paragraph breaks.(<q>元素旨在用于不需要分段的短引用)
另一个你在web上看到的相当常见的元素是
<abbr>
——它常被用来包裹一个缩略语或缩写,并且提供缩写的解释(包含在
title
属性中)。

HTML有个用于标记联系地址的元素——
<address>
。它仅仅包含你的联系地址,例如:
<address>
<p>Chris Mills, Manchester, The Grim North, UK</p>
</address>


但要记住的一点是,
<address>
元素是为了标记编写HTML文档的人的联系方式,而不是任何其他的地址。

当你使用日期、化学方程式、和数学方程式时会偶尔使用上标和下标,所以它们有正确的意义。 
<sup>
 和
<sub>
元素可以解决这样的问题。例如:
<p>My birthday is on the 25<sup>th</sup> of May 2001.</p>
<p>Caffeine's chemical formula is C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>.</p>
<p>If x<sup>2</sup> is 9, x must equal 3 or -3.</p>


表示计算机代码Edit

有大量的HTML元素可以来标记计算机代码:
<code>
:
用于标记计算机通用代码。
<pre>
:
用于标记固定宽度的文本块,其中保留空格(通常是代码块)。
<var>
:
用于标记具体变量名。
<kbd>
:
用于标记输入电脑的键盘(或其他类型)输入。
<samp>
:
用于标记计算机程序的输出。

HTML 还支持将时间和日期标记为可供机器识别的格式的 
<time>
 元素。例如:
<time datetime="2016-01-20">20 January 2016</time>

(文章内容摘自MDN、菜鸟教程等网站)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: