What's the point of valid CSS/HTML?

2019-01-06 17:50发布

If I've tested my pages in most major browsers, why would I need to maintain a validated code? I want to use box-shadows and corner radius if they're supported in WebKit browsers and Firefox. I don't care if they don't show up on Internet Explorer. But I keep my HTTP requests down by not including images instead.

Are there are advantages to valid code? In SEO or otherwise?

17条回答
该账号已被封号
2楼-- · 2019-01-06 18:40

Because, only by knowing the rule, will you know when to break it.

Using browser-specific extensions isn't bad, but it is something you want to do on purpose, not blindly.

Validation points out the places where you deviate from the standard. Maybe you needed to, maybe you didn't, that decision is yours.

查看更多
成全新的幸福
3楼-- · 2019-01-06 18:40

Ask that to all the people who wrote code that worked fine when they tested it in IE 6 and then it broke when IE started supporting the standards better.

查看更多
别忘想泡老子
4楼-- · 2019-01-06 18:41

You should always have valid (X)HTML because there are very few occasions where the benefits of not having valid code outweighs the benefits of not having validated code.

For CSS, however, there is little reason to be as strict. All your CSS should be proper and work as intended, follow best practices and optimize where possible. Other than that, use all the browser specific experimental stuff you want, it won't noticably affect other browsers.

查看更多
The star\"
5楼-- · 2019-01-06 18:46

Validating code is one can prevent many find and hopefully fix many problems in your html/css that could cause undesired results. IMHO its more of a "common things that could be wrong" fix than a replacement for testing. If you like the look you're getting in the browsers you want, I wouldn't worry too much about the validation.

(Yeah, you can put the little badge on your website if you want everybody to know you use validation to check your site) :D

查看更多
The star\"
6楼-- · 2019-01-06 18:48

Here is another point... If you're writing a SharePoint web part, you can just about the worst possible, messy, cruffy and dodgy HTML you could possibly imagine, and your web part would feel right at home in SharePoint.

It actually amuses me seeing purists try code valid HTML strict for a MOSS plugin when the entire framework spits out garbage.

Its no wonder you can't find anything on a corporate intranet....

查看更多
登录 后发表回答