mark
元素用于标注一段文本,这段文本会突出显示。在需要引用其他人的内容,而你想引起别人注意时,就可以使用 mark
元素.
也可以使用 mark
标注重要的内容或关键字——就像搜索引擎在搜索结果中显示匹配的文本那样,还可以与 del
(删除的文本)和 ins
(插入的文本)组合使用,以标注文档的变化。实话实说, mark
元素其实并不十分必要。HTML5规范认为它是一个语义元素,但实际上它更多地则是被用于表现目的。默认情况下,被标注的文本会带有浅黄色背景(见图3-2),不过当然可以通过样式表规则为它应用不同的样式。
提示
mark
元素的目的并不在于样式。毕竟,突出显示文本的方式已经有很多了。因此,应该坚持只用mark
(结合你想使用的任意CSS格式)来传达适当的语义。这里有一条经验,那就是使用mark
来吸引人注意那些变得很重要的文本。比如,关于写作该文本的>讨论,或者它是用户应该执行的任务。
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title><mark> Example</title></head><body><p>In 2009, Facebook made a bold grab to own everyone's content,<em>forever</em>. This is the text they put in their terms of service:</p><blockquote>You hereby grant Facebook an <mark>irrevocable, perpetual, non-exclusive, transferable, fully paid, worldwide license</mark> (with the right to sublicense) to <mark>use, copy, publish</mark>, stream, store, retain, publicly perform or display, transmit, scan, reformat, modify, edit, frame, translate, excerpt, adapt, create derivative works and distribute (through multiple tiers), <mark>any user content you post</mark> on or in connection with the Facebook Service or the PRomotion thereof subject only to your privacy settings or enable a user to post.</blockquote><p>Fortunately, they've since backtracked and weakened the language considerably.Here's the relevant section today:</p><blockquote><mark>You own all of the content and information you post on Facebook</mark>, and you can control how it is shared through your privacy and application settings. In addition: 1. For content that is covered by intellectual property rights, like photos and videos ("IP content"), you</mark> specifically give us the following permission, subject to your privacy and application settings: <mark>you grant us a non-exclusive, transferable, sub-licensable, royalty-free, worldwide license to use any content that you post</mark> on or in connection with Facebook. <mark>This license ends when you delete your content or your account</mark> unless your content has been shared with others, and they have not deleted it.</blockquote></body></html>
新闻热点
疑难解答