大佬教程收集整理的这篇文章主要介绍了HTML5:标记文字,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
HTML5规范明确指出:使用元素应该完全从元素的语义出发。但这类元素中有些元素的含义非常明确,有些则比较含糊。在元素的使用上最好做到“将呈现工作交给CSS打理”,但这并不是绝对的,有时候只要保持HTML文档中的一致性就好。
<body> I like <a href="http://en.widipedia.org/wiki/Apples">apples</a> and <a href="http://en.wikipEIDa.org/wikI/Orange_(fruit)">oranges</a>. </body>URL中用得最多的协议就是http,但浏览器也支持其它协议,例如:https和ftp。如果想引用一个电子邮箱地址,可以使用mailto协议,如:mailto:adam@mydomain.com。
<body> ...... You can see other fruits I like <a href="fruitlist.html">here</a>. </body>默认情况下,浏览器会假定目标资源与当前文档位于同一位置,不过可以通过 base元素提供一个基础URL加以改变。
<body> ...... You can see other fruits I like <a href="#fruits">here</a>. ...... <p id="fruits"> I also like bananas,mangoes,cherries,apricots,plums,peaches and grapes. </p> </body>用户点击链接,文档就会滚动到能看到id为fruits的元素的位置。
<html> <frameset cols="50%,50%"> <frame src="test.html" /> <frame name="frame1" /> </frameset> </html>这里定义了一个frameset,里面包含两个frame,宽度各占一半,第一个frame指向了一个html文档,第二个frame被赋予了名称frame1。test.html的内容如下:
<!DOCTYPE html> <html lang="en"> <head> <Meta charset="utf-8" /> <title>Your page title</title> <link href="test.css" rel="stylesheet" id="test"/> </head> <body> <a title="W3C web site" href="http://w3c.org" target="frame1">W3C web site</a> </body> </html>在a元素中我们定义了target微frame1,这样在点击链接时,将在frame1中打开新的页面。
<body> <em>I</em> like <b>apples</b> and <b>oranges</b>. </body>em元素的习惯样式是斜体字。此例对句子开头的I进行了强调。
<body> <em>I</em> like <b>apples</b> and <b>oranges</b>. My favorite kind of orange is the mandarin,properly kNown as <i>citrus reticulata</i>. </body>i元素的习惯样式是斜体,同em元素。
<body> <em>I</em> like <b>apples</b> and <b>oranges</b>. My favorite kind of orange is the mandarin,properly kNown as <i>citrus reticulata</i>. Oranges at my local store cost <s>$1 eanch</s> $2 for 3. </body>
<body> I like apples and oranges. <strong>Warning:</strong> EaTing too many oranges can give you heart burn. </body>strong元素的样式同b元素。
<body> I like apples and oranges. <strong>Warning:</strong> EaTing <u>too many</u> oranges can give you heart burn. </body>由于u元素的习惯样式与a元素类似,为了防止混淆,应该尽量避免使用u元素。
<body> <p>Order Now to receive free shipping. <small>(Some reStrictions may apply.) </small></p> ... <footer role="contenTinfo"> <p><small>© 2013 The Super Store. All Rights Reserved. </small></p> </footer> </body>注意:small只适用于短语,不要用它标记长的法律声明,如“使用条款”和“隐私政策”页面。
<body> The point x<sub>10</sub> is the 10<sup>th</sup> point. </body>
<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>
<body> This is a very long word: Super<wbr>califragilistic<wbr>expialidocIoUs. </body>不使用wbr元素时,浏览器会将长单词作为一个整体进行处理,而使用了wbr元素,浏览器则可以选择在建议处换行。使用wbr元素,就是告诉浏览器一个单词最适合在什么地方那个拆分。
<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>
<body> I like apples and oranges. The <abbr title="Florida Department of Citrus">FDOC</abbr> regulates the Florida citrus industry. </body>
<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>该元素没有习惯样式,因此其内容看上去没有什么特别之处。
<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元素的习惯样式是在引文前后生成引号。
<body> <ruby>魑<rp>(</rp><rt>chi</rt><rp>)</rp></ruby> <ruby>魅<rp>(</rp><rt>mei</rt><rp>)</rp></ruby> </body>当显示在支持注音符号的浏览器中时,rp元素及其内容会被忽略,rt元素的内容则会作为注音符号显示。而在不支持注音符号的浏览器中显示该文档,那么rp和rt元素的内容都会被显示出来。
<body> <p> This is left-to-right: <bdo dir="ltr">I like oranges</bdo> </p> <p> This is right-to-left: <bdo dir="rtl">I like oranges</bdo> </p> </body>
<body> <p> I would like a <mark>pair</mark> of <mark>pears</mark> </p> </body>
<body> <p> <del>I can <mark>sea</mark> the <mark>see</mark></del> <ins>I can <mark>see</mark> the <mark>sea</mark></ins> </p> </body>
<body> I still remember the best apple I ever tasted. I bought it at <time datetiR_406_11845@e="15:00">3 o'clock</time> on <time datetiR_406_11845@e="1984-12-7">December 7th</time>. </body>time元素可以不包含datetiR_406_11845@e属性,这时需要提供具备有效的机器可读格式的时间和日期,当时间和日期格式不规范时,则需要使用datetiR_406_11845@e属性来指定文本内容的机器可读格式。
以上是大佬教程为你收集整理的HTML5:标记文字全部内容,希望文章能够帮你解决HTML5:标记文字所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。