<p>Even though I always strive for complete validation these days, I often wonder if it's a waste of time.  If the code runs and it looks the same in all browsers (I use browsershots.org to verify) then do I need to take it any further or am I just being overly anal?</p>

<p>What level do you hold your code to when you create it for:</p>

<p>a) yourself
b) your clients</p>

<p>P.S. Jeff and company, why doesn't stack overflow validate? :)</p>

<p><strong>EDIT: Some good insights, I think that since I've been so valid-obsessed for so long I program knowing what will cause problems and what won't so I'm in a better position than people who create a site first and then "go back and fix the validation problems"</strong></p>

<p><strong>I think I may post another question on stack overflow; "Do you validate as you go or do you finish and then go back and validate?" as that seems to be where this question is going</strong></p>

[{'answer_id': 7945, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 5, 'selected': True, 'text': "<p>a) Must look the same</p>\n\n<p>b) As standards-compliant as possible, but not so anal that it blocks finishing work</p>\n\n<p>In a situation where you have perpetual access to the code, I don't think standards-compliance is all that important, since you can always make changes to the code if something breaks. If you don't have perpetual access (ie, you sign off on the code and it becomes someone else's responsibility), it's probably best to be as standards-compliant as possible to minimize maintenance headaches later... even if you never have to deal with the code again, your reputation persists and can be transmitted to other potential clients, and many teams like to blame the previous developer(s) for problems that come up.</p>\n"}, {'answer_id': 7947, 'author': 'pix0r', 'author_id': 72, 'author_profile': 'https://Stackoverflow.com/users/72', 'pm_score': 0, 'selected': False, 'text': "<p>I think validation is a good litmus test of whether you've done things properly, so if there are only a few minor problems, why not fix them and ensure your site will at least be understood correctly by browsers in the future (even if they do render things differently for other reasons)?</p>\n\n<p>OTOH, for most projects, validation seems like a huge headache and if you can get things working across browsers, it's not worth spending an extra day/week+ on just validation.</p>\n"}, {'answer_id': 7948, 'author': 'GaryF', 'author_id': 1035, 'author_profile': 'https://Stackoverflow.com/users/1035', 'pm_score': 2, 'selected': False, 'text': '<p>I think this is an area in which you should strive to use the <a href="http://en.wikipedia.org/wiki/Postel%27s_law" rel="nofollow noreferrer">Robustness principle</a> as far as is practical (which is good advice for any area of coding). Just because something works today doesn\'t mean it will work tomorrow: if you\'re relying on a particular HTML/CSS hack or even if you\'ve just been a little lax in emitting strictly valid code, the next iteration of browsers could well break. Doing it once the right way minimises this problem (though does not entirely mitigate it).</p>\n\n<p>There is a certain element of pragmatism to take here, though. I\'d certainly do all I could for a client\'s site to be valid, but I would be willing to take more risks in my own space.</p>\n'}, {'answer_id': 7951, 'author': 'BlaM', 'author_id': 999, 'author_profile': 'https://Stackoverflow.com/users/999', 'pm_score': 2, 'selected': False, 'text': '<p>I think it\'s only "tech" guys that really care for "100% standard compliance". My usual page consumers (= users) don\'t care if there\'s no alt-attribute for a "menu border picture element".</p>\n\n<p>I usually just make sure that I don\'t see any obvious errors (all tags closed, all lower case, attributes in quotes, ...), but if it looks good on IE and FF, that\'s all I care for. I don\'t really care if I use a non-standard attribute in any HTML tag, so that the page doesn\'t validate against an DTD - as long as I get the visual results that I intended to get.</p>\n'}, {'answer_id': 7952, 'author': 'HoboBen', 'author_id': 840, 'author_profile': 'https://Stackoverflow.com/users/840', 'pm_score': 1, 'selected': False, 'text': "<p>I know this isn't answering your whole question, but it is worth considering that by using completely valid html you can be sure that your website should work properly in <strong>future</strong> web browsers that haven't been released yet.</p>\n"}, {'answer_id': 9208, 'author': 'Andrew G. Johnson', 'author_id': 428190, 'author_profile': 'https://Stackoverflow.com/users/428190', 'pm_score': 1, 'selected': False, 'text': '<p>My approach tends to be to ensure I can completely validate on all pages, however I still send the page as text/html instead of application/xhtml+xml so there are no ugly XML errors in the event I have missed something.</p>\n'}, {'answer_id': 9230, 'author': 'icco', 'author_id': 1063, 'author_profile': 'https://Stackoverflow.com/users/1063', 'pm_score': 1, 'selected': False, 'text': "<p>For me, I feel like I've done a good job if my code validates. Seeing the green check box on the w3c pages just makes me slightly giddy. As for group b, They usually only care that it looks and works the same across browsers. They only place I've found that this is not true is the government sector. They require complete validation not only with the w3c but also passing ADA tests (basically how does it sound with a screen reader). </p>\n\n<p>p.s. when I say government sector, I mean specifically the state of California and a few counties inside it. I have had no ther experience with other government groups besides them.</p>\n"}, {'answer_id': 9653271, 'author': 'DavyB', 'author_id': 1261975, 'author_profile': 'https://Stackoverflow.com/users/1261975', 'pm_score': 0, 'selected': False, 'text': '<p>Except that the validators themselves are so positively anal,\n when they flag an error or warning whenever a -moz- or -webkit or -o- i.e. a browser specific qualification term is used.\nalso they want you to specify 0px rather than 0 or other units\nZero is Zero whatever units the validator wants to check it against!</p>\n\n<p>just try validating the WordPress twentyeleven style.css it throws 140 odd errors which are all of the nature above or the validator is recovering from parse errors</p>\n\n<p>The validators are useless if you cannot sort the wheat from the chaff!!!</p>\n\n<p>We need validators that recognise browser specific qualification terms!</p>\n'}, {'answer_id': 14706469, 'author': 'inigomedina', 'author_id': 574093, 'author_profile': 'https://Stackoverflow.com/users/574093', 'pm_score': 2, 'selected': False, 'text': '<p>For understanding <strong>why</strong> validation matters, it is needed to understand <a href="http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/" rel="nofollow">how a browser works</a> at its different layers, and also a little bit about the history of web from the perspective of web browsers.</p>\n\n<p>The HTML you give to a browser is interpreted by the browser following the DOM, an application programming interface that maps out the entire page as a hierarchy of nodes. Each part of that  <em>tree</em> is a type of node containing different kinds of data. DOM (Document Object Model) was necessary because of the diversity of HTML pages that early web browsers (Netscape, IE...) implemented to allow alter the appearance and content of a web page without reloading it. For preserving the cross-platform nature of the web, W3C wanted to fix the different implementation of those browsers, proposing DOM.</p>\n\n<p>DOM support became a huge priority for most web browsers vendors, and efforts have been ongoing to improve support on each release. So, it worked.</p>\n\n<p>DOM is the very basic step with which a web browser starts. Its main flow is:</p>\n\n<ol>\n<li>parsing HTML to construct the DOM tree</li>\n<li>render tree construction</li>\n<li>layout of the render tree</li>\n<li>painting the render tree</li>\n</ol>\n\n<p>The step 1 gives the <strong>content tree</strong>, with the tags turned to DOM nodes. The step 2 gives the <strong>render tree</strong>, containing styling information.</p>\n\n<p>So, <strong>why</strong> validation matters: because <strong>content tree</strong> and <strong>render tree</strong> are the basis from which the web browser start its job. The most they are well defined, the better for the web browser.</p>\n\n<p>Ultimately, the DOM is also the basis for your JavaScript events. So, its validation helps to the interaction layer too.</p>\n'}]
['https://Stackoverflow.com/questions/7940', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/428190/']