A friend recently finished reorganizing his site and finally got it online. He had wanted to build the whole thing from scratch for a long time, but time was tight, and there was always the risk of abandoning a half-written system midway through. In the end, he chose Typecho to set up the blog.
After that came the theme planning. His taste is straightforward: clean layout, no flashy decoration, and the same pale blue he always seems to prefer.
That led us into the usual discussion about browser compatibility. He is the kind of person who likes to take things all the way, so he wanted the site to work across IE5, IE5.5, IE6, IE7, IE8, IE9, Firefox, Chrome, Opera, and even some early versions of non-IE browsers. He had also written print CSS. Wanting to support as many browsers as possible is fine in principle, but realistically, there is a point where it stops being necessary.
We also ended up talking about W3C standards. To be honest, I have never paid that much attention to them. My view has always been that what the user actually sees matters more than passing a standard for its own sake. Standards can help, but they are not sacred. They remind me a bit of school exams with fixed answers, while in other contexts people value more open-ended thinking.
His pages all passed W3C validation, so I decided to test mine too. I did not dare start with the blog pages and only checked the site homepage first. The result was blunt: 8 errors in a fairly short piece of code.
Looking through them, some were surprisingly basic. That probably comes from not paying much attention to W3C rules in the first place. For example, W3C does not support border="0" or target="_blank".
border="0" can be replaced with img {border:none}. As for target="_blank", you rarely see it in some overseas designs. The idea there is that forcing a new window is not especially user-friendly, so the user should decide whether to open a link in the current window or a new one, often through the mouse wheel click. That logic breaks down somewhat in the domestic context, especially because IE6 does not support opening links in a new window by clicking the mouse wheel. On many sites, target="_blank" gets used everywhere, often in the name of page views. My homepage only had one external link anyway, the ICP registration link, so I simply removed the target="_blank" from it.
Then there was a nesting issue. A <div> cannot be nested inside a <script> block during validation. The fix is to add a CDATA marker so the validator does not treat tags inside the script as actual nested tags.
There was also the & issue. According to the validator message, & inside links needed to be changed to &. After correcting that, the problem was gone.
I uploaded the revised file and ran the validation again. This time, everything passed.
Out of curiosity, I checked the W3C status of a few major sites. The results were a mess. On their homepages alone, Microsoft showed 109 Errors and 34 warnings; Google had 36 Errors and 2 warnings. I still remember that a long time ago Microsoft's homepage passed W3C validation completely. That clearly did not last.
Later I had another impulse and ran the CSS through W3C validation too. To my surprise, it passed, with only one warning related to fonts.
By the spec, browsers are supposed to recognize font aliases automatically and map them to the correct font file. For example, font-family:Microsoft YaHei, font-family:'微软雅黑', and the Unicode form font-family:'\5FAE\8F6F\96C5\9ED1' are supposed to be equivalent. Unfortunately, many browsers do not seem to handle the first form correctly. Opera, for example, does not recognize font-family:Microsoft YaHei.
On the homepage, I did not use any CSS Hack or CSS3. It seems that once CSS Hack is involved, validation becomes difficult anyway. The stylesheet there was still effectively CSS 2.1, and CSS3 would definitely not pass. In any case, CSS3 still has not reached the point of one fully unified standard in actual implementation. Each browser has long had its own approach, and getting everyone onto the same page is extremely hard.
In practice, very few people probably bother validating CSS against W3C. The real question is simple enough: is it more important that the page displays properly for users, or that it satisfies the standard perfectly?
I also checked the blog homepage and found a few small issues, so I fixed them along the way. I was not trying to obsess over every last validation detail, and in many cases it is not that easy to resolve everything cleanly.