网络编程
位置:首页>> 网络编程>> 网页设计>> 语义化的HTML与搜索引擎优化(如何编写纯语义的HTML进行搜索引擎优化)(3)

语义化的HTML与搜索引擎优化(如何编写纯语义的HTML进行搜索引擎优化)(3)

作者:Joost.De.Valk 来源:W3CGroup 发布时间:2009-12-28 12:42:00 

标签:搜索引擎,html,语义化

Images
图像

Images are used in all sorts of ways within documents, and you should apply the proper semantics to them. The only really useful semantic variable on an img tag is the alt attribute, and it should only be used if the image adds meaning to the document. If the image is there only for decorative purposes, leave the altattribute empty. Otherwise, describe what the image is showing in the alt attribute.

图像在一个文档中以各种不同的方式使用着,你需要给它们应用上一些适当的语义。在img标签上真正有用的语义变量就是alt属性,它仅用在图像在文档中注明它所表达的含义的时候。如果某些图像仅仅是为了装饰的目的,那么可以使alt为空,否则,都需要指明它们的alt属性值。

If you're using images to replace text, because you want the text to look nicer (image replacement,) make sure that you're using normal text in your HTML, and that you replace that text with images by using CSS. You have to do this because both people with visual impairments and search engines cannot read the text in your images. My own preferred method of doing this is through applying the image with CSS background-image, and then hiding the HTML text using a large text-indent (about -1000px or so does the trick.) Be careful though: the text in the image should be exactly the same as the text in your document. If it's not, you risk losing a lot of ranking value from the search engines.

如果你要以图换字,使得文字看起来更漂亮(用图片替换),请务必在你的HTML代码中也写上正常的文字,而且,你需要使用CSS来将图像替换相应的文字。这样做的目的是因为要兼顾到那些视觉障碍的人,并且搜索引擎无法读取图像里的文字。我的首选方法是使用background-image来显示这个图片,然后使用一个很大的text-indent(比如-1000px或其他能达到效果的值)来隐藏文字。注意:图像中的文字应该和文档中的文字完全一样,否则,你将冒上被搜索引擎降低排名的风险。

Abbreviations and acronyms
缩写和首字母组合词

You're bound to do it as a web designer - I do it in this article several times - using acronyms or abbreviations. When you do, make sure you provide the written out version of the term using abbr or acronym tags. That's good for your keyword density too!

作为一名网页设计师,你一定会使用到,我在这篇文章里就用了好几次,使用首字母组合词或缩写。当你使用它们的时候,请将术语写到abbr或acronym标签里并在它们的title属性中写出该术语的全称。这对增加你的关键词密度同样有益。

Tables
表格

We all know why using tables for layout out web sites is bad, and we also know what they are supposed to be used for - displaying tabular data. Just using basic tables is a big step in the right direction, but there are a number of ways in which you can improve your tables' semantic value, thereby improving your site's SEO further:

我们都知道为什么用表格来呈现页面布局是不和谐的,我们知道,表格应该用来显示表格式数据。只使用它这个基本的功能是正确的,不过,有一些方法可以用来改善表格的语义,改进SEO。

- Use table headings(th) for your table's headings(it's really that easy)
- 为表格中的标题使用标题标签(th,这很容易)

- If you can,use the thead,tbody and tfoot sections to properly section your table
- 如果可以,使用thead,tbody和tfoot进行对你的表格进行合理的划分

- provide a caption for your table,describing what's in it
- 为表格提供一段说明标题写在caption标签里

The caption and the table headings would be a good,and usually natural place to use some of your document's keywords.
caption和th可以很自然的放置一些文档关键词,很和谐。

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com