小白教程

 找回密码
 立即注册
小白教程 首页 Html编程教程 查看内容

进阶文字格式

发布者: 小白教程

HTML中还有许多其他用于格式化文本的元素,我们在HTML文本基础知识文章中没有涉及到本文中描述的元素鲜为人知,但仍然很有用(无论如何,它仍然不是完整的列表)。在这里,您将了解有关标记报价单,描述列表,计算机代码和其他相关文本,下标和上标,联系信息等的信息。

先决条件:基本的HTML熟悉程度,如HTML入门中所述HTML文本格式,如HTML文本基础知识所述
客观的:了解如何使用鲜为人知的HTML元素标记高级语义功能。

说明清单

在HTML文本基础知识中,我们介绍了如何标记HTML中的基本列表,但是我们没有提到偶尔会遇到的第三种类型的列表-描述列表这些列表的目的是标记一组项目及其相关描述,例如术语和定义或问题和答案。让我们来看一组术语和定义的示例:

soliloquy
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.)
monologue
In drama, where a character speaks their thoughts out loud to share them with the audience and any other characters present.
aside
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

说明列表使用与其他列表类型不同的包装器- <dl>另外,每个术语都包装在<dt>(描述术语)元素中,每个描述都包装在<dd>(描述定义)元素中。让我们结束标记示例:

<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>

浏览器的默认样式将显示描述列表,其中描述与术语有所不同。

请注意,允许使用带有多个描述的单个术语,例如:

<dl>
  <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>
  <dd>In writing, a section of content that is related to the current topic, but doesn't fit directly into the main flow of content so is presented nearby (often in a box off to the side.)</dd>
</dl>

主动学习:标记一组定义

是时候尝试一下描述列表了;将元素添加到“输入”字段中的原始文本中,以使其在“输出”字段中显示为描述列表如果愿意,您可以尝试使用自己的术语和描述。

如果输入有误,可以随时使用“重置”按钮将其重置如果您确实遇到问题,请按“显示解决方案”按钮以查看答案。

报价单

HTML还具有标记报价的功能。使用哪个元素取决于您是标记块引用还是内联引用。

块引用

如果某段块级内容(包括一个段落,多个段落,列表等)被其他地方引用,则应将其包装在一个<blockquote>元素中以表示这一点,并包括指向引用源的URL。在cite属性内。例如,以下标记取自MDN<blockquote>元素页面:

<p>The <strong>HTML <code>&lt;blockquote&gt;</code> Element</strong> (or 
上一篇:测试你的技能!下一篇:HTML 基础

Archiver|手机版|小黑屋|小白教程 ( 粤ICP备20019910号 )

GMT+8, 2024-9-20 06:18 , Processed in 0.020624 second(s), 18 queries .