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

2019-01-28 21:30:12王冬梅

small元素

HTML5中使用small标签指定细则,通常包括免责声明、注意事项、法律限制、版权信息等。有时还可以用它来表示署名,或者满足许可要求。

<body> <p>Order now to receive free shipping. <small>(Some restrictions may apply.) </small></p> ... <footer role="contentinfo"> <p><small>&copy; 2013 The Super Store. All Rights Reserved. </small></p> </footer> </body>

注意:small只适用于短语,不要用它标记长的法律声明,如“使用条款”和“隐私政策”页面。

sub和sup元素

sub和sup元素分别用于表示下标和上标。

<body> The point x<sub>10</sub> is the 10<sup>th</sup> point. </body>

换行

有两个元素可以用来控制内容换行:br和wbr元素。

br元素

br元素会引起一次换行,br元素只宜用在换行也是内容的一部分的情况,切勿用它创建段落或别的内容组。

<body> I WANDERED lonely as a cloud<br/> That floats on high 0'er vales and hills,<br/> When all at once I saw a crowd,<br> A host, of golden daffodils; </body>

wbr元素

HTML5新增,用于表示长度超过当前浏览器窗口的内容适合再次换行,究竟换不换行由浏览器决定,wbr元素只不过是对恰当的换行位置的建议而已。

<body> This is a very long word: Super<wbr>califragilistic<wbr>expialidocious. </body>

不使用wbr元素时,浏览器会将长单词作为一个整体进行处理,而使用了wbr元素,浏览器则可以选择在建议处换行。使用wbr元素,就是告诉浏览器一个单词最适合在什么地方那个拆分。

表示输入和输出

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>