笑死我了,马上发出摘录和部分翻译(多意译,那样难度小一些,我E文一般般)。

http://www.sitepoint.com/forums/showthread.php?s=5895d02376253cff21f1c0d8d710eaf7&t=204194

非常抱歉,这个“马上”,“马上”了4-5个小时,都怪这个帖子太长,中午的饭太香,网速这么慢,而我对睡懒觉又这么擅长,…

为什么要使用xhtml验证的精彩问答

原文在:

http://www.sitepoint.com/forums/showthread.php?s=5895d02376253cff21f1c0d8d710eaf7&t=204194

问题大约是,为什么要验证,不验证在浏览器里也看着好好的呀。回复挺有意思的,摘录部分如下:

以下为引用内容:

The thing isn’t “what works now” but “what will work in the future”. By using standards, you are making your sites “future safe”. And if everyone made their sites standards-complient, then the browser makers would make sure that their browsers work according to those standards.

Keep in mind that if you use non-standard markup, it might work, but there is no guarentee that it will work in future browsers.


问题在于不仅仅是现在网页显示没问题,而是将来也要没问题。记住,不标准的页面现在能看,将来不一定。

以下为引用内容:

particularly if you move from old-style table based layout to css driven sites, you absolutely should ensure that documents and stylesheets validate, as the browser inconsistencies when they don’t are a nightmare.

and, on a more ideological level: if you use a syntax, why not do it properly and make sure it’s error free? it’s a bit like saying: i don’t have a driver’s license, and there’s a lot of traffic laws i don’t know or understand…but i can drive a car nonetheless, so why should i bother?


在你的代码还没有乱成一场噩梦之前,把表格从你的页面中去掉。(深有同感,我经常会被叫去在一个嵌套了7-8层的页面中查找一个错误,而且,更糟糕的是,很多手写和拷贝粘贴、修改过的代码根本没有缩进,很多结束

标签被丢掉了,丢掉合并的行或列更是家常便饭。而且这种已经嵌入了后台代码的乱哄哄的文字无论在dreamweaver或者后台的代码编辑器中都不能正确地显示或者格式化!IBM jsp开发环境的那个破玩意的格式化代码,会任意修改前台代码的大小写,而DOM是分大小写的,或者任意加空格!导致js错误。-郭爽注)

以下为引用内容:

No doubt that in the next projects I will take a closer look in validating my sites, but I haven′t done it in my current projects, as my logic tells me, if my sites work well in all these browsers the code would be ok.

Future safe is just a matter of updating my browsers and still keep a few old, to make sure it works for people who haven′t updated, we all know way to well how many people are still using old browsers.

An example:

I like to color my scrollbars, the CSS code for this is not standard and it only works with IE version 5.5 and 6.0 on Windows, but I use it anyway, why? because 90% of my visitors can see it.


不用怀疑,下个项目我一定会验证,但手头的项目先不考虑。…虽然设置滚动条颜色的css不符合验证标准,但我还是在使用,为什么?因为至少还有90%的人可以看到这个效果。

以下为引用内容:

分别针对上面回复的回复,:)

sorry, but: if your pages don’t validate, it’s only by chance (and thanks to the leniency of browsers’ error handling and guessing mechanisms) that they actually display correctly.

you seem to miss the point that even old browsers actually work with VALID code…

well, by that logic…do whatever. don’t worry about validation. heck, don’t worry about adding vbscript, jscript, activeX and any other cruft to pages…


验证不通过的页面只有部分机会被正确显示(这还要感谢浏览器对错误的宽大处理和猜测技巧)

你可能忘记了这一点—就算是老的浏览器也可以正确显示验证过的代码

以下为引用内容:

I just checked HTML and CSS validation for my company site, which cost a lot of money, and is the center of 55.000 employees, and it doesn′t validate at all - lots of errors all the way down the code, but the site looks fine, even in Netcape 4.7.

Please don′t misunderstand me about the title of this topic, I would love to have just one standard that all browsers use and work perfectly, so I don′t have to test them all, but in the real world it′s not like this unfortunately.


刚才,我检查了我们公司站点的验证情况,做这个站点可是花了不少钱,55000个人在使用这个站点,但根本不能通过验证,大量的验证错误,但是即使是netscape4.7也可以正确的显示。

不要误解我的意思,我也很高兴有这么一个标准,这样就不用一个一个地测试所有浏览器了。但是真实的世界却不是这么回事。

以下为引用内容:

I see that you don’t test your work in Opera, Safari, or IE for the Mac. Lots of standards advocates make their sites work in those browsers as well. It’s not just about IE and Netscape you know.

我发现你没有测试 opera,Safari和苹果版的IE(Mac IE和咱们常见的IE有很大的不同,根本就不是同一个项目组做的,虽然版本号可能一样或者相近-郭爽注)

以下为引用内容:

Well, I don′t have a Mac to test on, but I always have a friend to test it for me. I think he only has IE and Safari installed, but I think I test on more browsers than the average designer, and how many here always code according to standards and not browsers?

我没有Mac来测试,但是可以叫我的朋友来帮忙,但我想他只装了IE和Safari。我想我作的测试已经比很多Web设计师多很多,这里又有多少人根据标准而不是浏览器的显示来写代码的呢?

以下为引用内容:

I code to both standards and common browsers, but I don’t freak out if my paragraphs are a couple of pixels narrower in IE5 or anything. If my layout is severely broken in a widely-used browser I’ll find a way to fix it, and I can do so using a standards-based method 99.9% of the time.

Going to standards doesn’t mean forsaking the browsers. As a matter of fact, debugging code becomes easier once it’s valid because you know when it’s a browser problem and when you made a mistake somewhere in your code.


我既看标准也用浏览器测试。我99.9%的时间都是根据标准来做页面。根据标准写代码和用浏览器测试并不矛盾,实际上,这样调试代码更容易了,因为你知道什么时候浏览器会出问题,什么时候你的代码会出问题。

以下为引用内容:

I only recently became interested in learning how to design using standards (I’m actually taking a class on XHTML and CSS right now and been reading Zeldman’s book.) but I thought I’d toss in yet another reason why it’s good to follow standards. I do believe it makes the sites accessible to a larger audience. You shouldn’t just think about desktop browsers, you should also think about folks who are viewing sites using screen readers, PDAs, and cellphones.

And I’ll just add that I’m loving the fact that Opera emulates small screen devices. 8-)


最近我才开始学习xhtml标准,我在上一个相关的课程。我觉得按照标准来写页面还有一个好处就是,更多的人可以用 screen readers(我猜这个就是windows附件里面的那个阅读器之类的东西,英文我忘了,就是可以把文字念出来的那个小软件,这样你就不用看显示器而是听了-郭爽注)或者PDA或者手机。

以下为引用内容:

As imouto said… have you tested all environments?

IE, Netscape, Firefox, Opera… great? On Windows, Mac and Linux? Great.

Cell phones?…PDAs?…Screen readers?

It’s worth it to read up on the standards and practice implementing them. Use them on your future sites and whenever you revise or update your existing ones.

When you get a hang of them, writing to standard can make the testing process much easier. For one, if you understand the styles properly, you have a higher chance of getting the site to look right on the first try. Plus, as has been mentioned, you gain the ability to test your code using the (X)HTML and CSS validators.

Of course, there’s a learning curve. If you’re used to writing code one way, using the presentational features of previous HTML version, it’ll take a bit of time to learn to use CSS efficiently. But it’ll pay off in the future of your sites, and as being an addition to your skillset.


IE, Netscape, Firefox, Opera?Windows, Mac and Linux? Cell phones?…PDAs?…Screen readers这些你都测试了吗?

如果你还在犹豫,那么我告诉你,按照标准可以使你的测试变得更容易。你越了解样式表,你就更能控制你页面的正确显示。而且前面也说了,你可以用 xhtml和css验证器来帮助你的测试。

当然,学习需要时间。如果你习惯了以前的html代码书写方式,学习新标准可能要花很多时间。这在将来会得到回报,还会提高你自己的技能。

以下为引用内容:

All environments ?

Which private web designer who works at home, has that possibility? I test on various browsers for PC (as posted above) and also have a friend test for me on Mac (2 browsers), Linux I never test on, because I don′t have access to a Linux machine and my stats for those users are so low that it′s not worth considering anyway.

Actually, I use statistics a lot to - specially about browsers, operating systems and screen resolution to insure that my sites work. I hardly never see any Linux users, and Cell phone, PDA, screen readers are all so rare, that I don′t consider them either.

The future changes of course, and eventually I will learn to validate my code, and more users will use small pocket browsers to go online, when that time comes, I will be ready…!

Thanks a lot for the comments on this, it′s always nice to learn about how people work on this.


(这个叫Wii的家伙还蛮倔的!-郭爽注)

以下为引用内容:

haps you don’t need to worry, for the sake of your sites

Perhaps you’re overlooking something… Earlier you mentioned having errors with Netscape 4.7, but dismissing it because only 1-2% of your audience is using it. Let’s put that into numbers. Say you have a fairly low 100 visitors a day. So that’s 1-2 visitors a day seeing a broken site. That’s 30-60/month, or 360-720 per year. If you have 1000 visitors daily, you’re talking about up to 600 monthly, 7200 yearly. Can you aford to turn 30, 720, or more potential customers away on a daily basis?

Worth considering, at least. 0.3% of traffic using PDAs, for example, may seem small, but if your site is popular enough, it can still be a large number of actual users. But this all depends on your site.

There’s no time like the present! Learning how to use the language properly can really cut down on development time, among other things. It doesn’t have to just be a headache for you.


以下为引用内容:

Well, if I created websites with 1000 daily visits I probably won′t be so relaxed about the whole thing.

But thanks, I got it - validated code is the way to go, also for me.


以下为引用内容:

Glad to hear it. Of all the reasons given here to validate code the best is that is makes designing and maintaining a site easier in the long run. If there is a display issue, you simply validate and fix those issues first. Often times this eliminates or seriously reduces the problem.

When developing a website, my advice is to always develop using Firefox with the “Web developer” extension. This extension allows you to validate HTML and CSS on the fly. Firefox’s built in DOM inspector allows you to look at the structure of the code from the browser’s perspective. Finally because Firefox more strictly adheres to W3C specifications than MSIE, and doesn’t include any browser specific tags (unlike MSIE) one is less likely to get sucked into browser specific traps.

Developing in Firefox and this testing in MSIE makes development go much faster and easier than trying to develop in MSIE and then test and fix for other browsers.


以下为引用内容:

The day I stopped worrying about NN4.x was the day my site launched forward. By abandoning NN4.x, I was able to streamline code thus reduce download time for my site and provide enhance functionallity. By eliminating tables to control layout as was necessary for NN4, I was able to create multiple layouts transparently. For instance my site displays one way on the computer screen and prints entirely differently.


这时候有人问用表格有什么坏处。

以下为引用内容:

Tables are generally considered visual media thus when interpreting them linearised they should still make sense and contain tabular data alone. Plus CSS is much more powerful at positioning elements and separating structure from presentation.

最重要的一点,用CSS而不是表格布局,可以把数据和表现方式完全分开。

以下为引用内容:

One point I agree strongly with is the validation which ‘doesnt matter’. I use the coloured scroll bars, which effect no one - but as long as this is the only pit fall, I count my site as validated!


验证本身并不重要,我就在使用滚动条颜色设置,所以验证不通过,但是我还是在页面上加了验证通过。

以下为引用内容:

If your site is valid it does not mean it is accessible at all, but you cannot have a truly accessible site if it doesn’t use valid syntax.

验证了不一定就符合accessible(易用性),不验证那就肯定不符合啦。

以下为引用内容:

One good way of testing for accessiblity is to use a text only browser like Lynx.

测试易用性的一个好办法就是用一个文本浏览器来测试,比如Lynx。

以下为引用内容:

…Valid HTML and CSS is one step, using HTML semanticly is another. There’s far more to accessibility than I could possibly fit in one post (or even one book).

验证只是第一步,还要合理使用html标签,甭说这个回复,就算一本书也不一定能说完。


以下为引用内容:

Start designing with standards but even more importand make your documents semanticly correct. Drop tables for layout and use CSS in you can. When you will do that you won’t have to worry so much for the looks but for actual content. And if you will be using CSS your new documents will style on its own once you have your stylesheet ready.

You will benefit from this on many levels:

- you’ll learn someting new

- it will be fun

- less pain

- more accesible

- it will take less space

And because your documents willl be well structured they will beeasy to read for search engines. That’s about it.


这个帖子太长了,以上只是前两页的部分回复。

要出去了,“电脑不是生活的全部”“周末应该与家人在一起…”,羡慕那些有勇气离开电脑的人。晚上回来再接着写。

[Edit on 2004-11-27 17:56:01 By guoshuang]
[Edit on 2004-11-27 20:18:51 By guoshuang]