html5标记文字_动力节点Java学院整理

2020-04-21 08:11:30易采站长站整理

1)code:表示计算机代码片段
2)var:在编程语境中表示变量,也可表示一个供读者在想象中插入一个指定值的占位符
3)samp:表示程序或计算机系统的输出
4)kbd:表示用户输入


<body>
<p>
<code>var fruits = ["apples", "oranges", "mangoes", "cherries"];<br> document.writeln("I like " + fruits.length + " fruits");</code>
</p>
<p>The variable in this example is <var>fruits</var></p>
<p>The output from the code is: <samp>I like 4 fruits</samp></p>
<p>When prompted for my favorite fruit, I typed: <kbd>cherries</kbd>
</body>

使用标题引用、引文、定义和缩写

abbr元素

表示缩写,其title属性表示该缩写代表的完整词语。


<body>
I like apples and oranges.
The <abbr title="Florida Department of Citrus">FDOC</abbr> regulates the Florida citrus industry.
</body>

dfn元素

表示定义中的术语,即用来解释一个词(或短语)的含义的句子中的词(或短语)。如果要为dfn元素设置title属性,那么必须将其设置为所定义的术语。


<body>
<p>
The <dfn title="apple">apple</dfn> is the pomaceous fruit of the apple tree, species Malus domestica in the rose family.
</p>
</body>

该元素没有习惯样式,因此其内容看上去没有什么特别之处。

q元素

表示引自他处的内容。q元素的cite属性可以用来指定来源文章的URL。


<body>
<p>
<q cite="http://en.wikipedia.org/wiki/Apple">The <dfn title="apple">apple</dfn> is the pomaceous fruit of the apple tree, species Malus domestica in the rose family.</q>
</p>
</body>

q元素的习惯样式是在引文前后生成引号。

cite元素

表示所引用作品的标题。


<body>
My favorite book on fruit is <cite>Fruit: Edible, Inedible, Incredible</cite> by Stuppy & Kesseler
</body>

其习惯样式是斜体。

使用语言元素

ruby、rt和rp元素

ruby元素表示一段包含注音符号的文字,需要与rt元素和rp元素搭配使用,rt元素用来标记注音符号,rp元素则用来标记供不支持注音符号特性的浏览器显示在注音符号前后的括号。