Go homepage(回首页) Upload pictures (上传图片) Write articles (发文字帖)
The author:(作者)归海一刀published in(发表于) 2014/3/30 5:21:07 十九 控制文本 Mastering Text_[Html教程]
现在br标签被使用过度,当本来应用p标签表示段落的时候。表示段落的时候应该使用p标签。同样的道理,有许多标签应该被用来定义可靠的文本元素,比如quotations引用语, abbreviations缩写和computer code计算机代码。
br
p
一定要注意,虽然浏览器可以多样实施这些标签,但一定要牢记不管每个元素看起来怎么样,一定要保证语意正确。
abbr用于缩写,acronym表示只取首字母的缩写
abbr
acronym
一个缩写词是个短语的缩写,非常一般,一个只取首写字母的缩写就是由一个短语的首个字母组成。所以CSS是个正确的只取首写字母的缩写,而HTML和XHTML不是(如果'Hypertext markup language' 取首写字母缩写就是'HML'同样的XHTML就是'EHML')。
应用最适合的可用性,用title表现短语的缩写或只取首写字母的缩写。
title
This web site is about HTML and CSS.
因为一些莫名其妙的原因,IE浏览器不支持abbr标签,一个叫Marek Prokop的朋友使用javascript让它工作,clever Javascript workaround
关于两个的使用方法有很多争议。Lars Holst的文章里提到 the most detailed insight
blockquote,p和cite用于引用语。blockquote是块元素用于大的引用,q是行元素用于小的引用。cite同样是行元素,比q更有语意,将来可能取代q。
blockquote
cite
q
title属性可以用来表示引用来自哪里。
q标签通常不改变上面的文本外观,如果你想改变可以使用CSS。
So I asked Bob about quotations and he said I know as much about quotations as I do about pigeon fancying. Luckily, I found HTML Dog and it said...blockquote, q and cite are used for quotations. blockquote is block-line and used for large or citations, whereas q is in-line and used for smaller phrases. cite is also in-line and preferable to q for its semantic nature and possible future deprecation of q.
So I asked Bob about quotations and he said I know as much about quotations as I do about pigeon fancying. Luckily, I found HTML Dog and it said...
blockquote, q and cite are used for quotations. blockquote is block-line and used for large or citations, whereas q is in-line and used for smaller phrases. cite is also in-line and preferable to q for its semantic nature and possible future deprecation of q.
有许多标签,code和var指定用来表示计算机代码。pre和 samp,它们同样主要应用在代码上。
code
var
pre
samp
code用于计算机代码。
var用于代码里面的变数说明。
ronankeatingisbland = true;
samp和code很相似,但它假定用于输出代码的例子。
pre是预先格式文本,在html标签里它与众不同,在它里面提供一个白色的禁区用于代码块显示。
<div id="intro"><h1>Some heading</h1><p>Some paragraph paragraph thing thing thingy.</p></div>
dfn是定义术语,用来高亮术语的第一个使用。像abbr和acronym,title属性用来描述术语。
dfn
Bob's canine mother and equine father sat him down and carefully explained that he was an allopolyploid organism.
address用于表示地址。
address
HMTL Dog HouseHTML StreetDogsvilleHT16 3ML
有些标签值得注意,但很少使用由于它们自身特殊性。
bdo可以颠倒文本,可以用来展示从右到左的语言。需要属性dir属性值ltr(从左到右)或rtl(从右到左)。
bdo
dir
ltr
rtl
god lmth
kbd用来显示用于需要打字的文本。
kbd
Now type woo hoo
ins和del分别用来展示编辑文本的插入和删除。它们有datetime属性(YYYYMMDD格式)和cite(一个链接用来说明插入删除的原因)。
ins
del
datetime
ins元素通常显示下划线,del元素通常显示删除线。
This is some nonsense very informative stuff that I've written.
b,i,sub,big,small都是表现元素,通过它们的定义就知道当语意和表现分离就不应再使用。b定义粗体,没有任何语意,这些标签定义纯粹是为了视觉特性,那些可以用CSS替代的工作。正确的标签是有语意的比如strong和em表示短语元素。如果你想独自复制这些标签的式样,不使用任何没有语意的标签,你应该使用CSS加span标签。
b,i,sub,big,small
b
strong
em
span
赞