学习笔记—HTML(3)

描述列表:

这些列表的目的是标记一组项目及其相关描述,例如术语和定义, 问题和答案等。

描述列表 (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>&lt;q&gt;</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、菜鸟教程等网站)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值