Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the point of valid CSS/HTML?

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?

like image 633
HyderA Avatar asked Aug 26 '09 22:08

HyderA


People also ask

What is HTML or CSS validation Why is it important?

CSS HTML Validator (previously named CSE HTML Validator) is an HTML editor and CSS editor for Windows (and Linux when used with Wine) that helps web developers create syntactically correct and accessible HTML, XHTML, and CSS documents (including HTML5 and CSS3) by locating errors, potential problems, and common ...

Is Valid HTML important?

Valid HTML code will help assure that your site renders well across all browsers, including the version GoogleBot uses for rendering websites. For example, CSS Custom Properties is not supported by version of Chrome used by GoogleBot for page rendering (Read: Google Engineer Issues Warning About Google Crawler).

Do you need to validate CSS?

Note: Validation is important. It will ensure that your web pages are interpreted in the same way (the way you want it) by the various web browsers, search engines etc. as well as users and visitors of your Web site. Follow the link given below to validate your CSS document.

What is a valid CSS selector?

The :valid selector selects form elements with a value that validates according to the element's settings. Note: The :valid selector only works for form elements with limitations, such as input elements with min and max attributes, email fields with a legal email, or number fields with a numeric value, etc.


6 Answers

  • Google prefers it so it is good for SEO.
  • It makes your web page more likely to work in browsers you haven't tested.
  • It allows you to generate or use your page as an XML document.
  • It makes you look more professional (to some developers at least)
  • Compliant browsers can render XHTML faster than HTML in quirks mode.
  • It points out a bunch of obscure bugs you've probably missed that affect things you probably haven't tested e.g. the codepage or language set of the page.
like image 139
Mike McQuaid Avatar answered Sep 29 '22 11:09

Mike McQuaid


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.

like image 21
richardtallent Avatar answered Sep 27 '22 11:09

richardtallent


One reason for having valid HTML is for accessibility. Screen reading software for visually impaired users works much better if the HTML on the page is valid.

like image 31
Charlie Avatar answered Sep 26 '22 11:09

Charlie


Invalid css/html may become horrible to maintain. Changes may have unwanted effects, which are hard to fix.

like image 45
Theo Lenndorff Avatar answered Sep 29 '22 11:09

Theo Lenndorff


You can't test in browsers that haven't been released yet!

Browsers tend to become more standards compliant over time. If you write standards-compliant webpages, they're more likely to still work in the next version of all existing browsers.

like image 25
Ken Avatar answered Sep 29 '22 11:09

Ken


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.

like image 4
Chuck Avatar answered Sep 26 '22 11:09

Chuck