views:

212

answers:

13

I have been developing websites for a couple years now and I almost never check if my pages are valid html and css. My check is by using a site such as browsershots.org and checking how it looks in all the different browsers. However recently I have been taking a college course and the prof wants us to validate every thing we turn in. It got me to thinking.

should I care if my pages validate or not?

A: 

Yes. Your teacher may reduce your grade otherwise.

Dimitry Z
+1  A: 

Just checking that your webpage looks good in different browsers might seem to work now, but in the future web browsers will change and your page might not look right anymore. If your pages are valid HTML and CSS, however, newer browsers should display them correctly in the future.

yjerem
A: 

I find that validation is a matter of principle more than what is required. It's very hypocritical to slate IE for its lack of standards compatibility when we still nowadays only test for the popular browsers.

ALWAYS check to see if your page is valid, always.

EnderMB
A: 

Well, this is almost holy war territory. If you are having trouble with CSS, making sure your HTML and CSS validate is a really good diagnostic step. It can sometimes cause accessibility problems if your HTML is very badly munged. Otherwise, there aren't really any practical reasons to worry about it.

Taking care in your work and pride in your craftsmanship, though, that's something else. If your pages validate, it's like a little gold star and you get a warm fuzzy feeling for a few seconds. It's a best-practice.

If you like doing things the absolutely right way, then sure, care about it.

Flubba
+1  A: 

you can (and should) validate your CSS/HTML

beyond getting better grades, some projects / industries will require validation for various purposes. if you're interested in a future career in any of these sectors may as well start now :)

Owen
A: 

Webpage validation is, in my mind, a complex matter. On the one hand, you have the W3C recommendation - that is just that: a recommendation - that might or might not (probably not) render equally in all browsers. On the other hand, you have your CSS/HTML tweaks and hacks that make each page render pixel-perfectly, but most probably doesn't validate with he W3C validator.

In real life, it's a world of compromises. I, personally, try to do both - have as few validation errors, but having the main emphasis on it actually looking good with widely used browsers.

But, in an academic life, I think it's entirely fair for the professor to require 100% W3C compliance. It is, however, the closest that we have of a spec for HTML/XHTML, and that's what the academic people are ultimately interested in - the theory.

Henrik Paul
+1  A: 

Yes standards are your defence in a changing world. Just because your site works with this crop of web browsers, there is not guarantees you will be good with the next if you are not standards compliant. Lets be honest web browsers will often be updated many times within the lifespan of a web site.

As a diligent developer I am sure you will retest as browsers get updated but there is a window between the update and you testing (remediating). :-)

Scott James
A: 

I always validate my web pages, and I recommend you do the same BUT many large company websites DO NOT and cannot validate because the importance of the website looking exactly the same on all systems requires rules to be broken.

In general, valid websites help your page look good even on odd configurations (like cell phones) so you should always at least try to make it validate.

Eric Wendelin
+4  A: 

Yes, for the reasons already covered here.

I realise you are not necessarily talking about commercial websites, but it is good to act as if you are anyway.

da5id
A: 

Validate to make sure you didn't make mistakes. If the validator complains about something you had to put in for browser compatibility, you can probably ignore that.

Bloodboiler
A: 

Absolutely! Your sites should be valid! Valid HTML/CSS is much more likely to work in future browsers 10 years from now!

Christoph Schiessl
A: 

As Eric said, a lot of big websites don't validate, however, if you start with a validating website that works perfectly in, for example, Firefox, Safari/Chrome, or Opera, chances are it will be right or mostly right in the other 3 and will only require minor adjustments for them to be right.

Then you can work on any hacks that might be needed for Trident based browsers like IE. For the majority of general websites, the hacks needed to make things work in IE7 and IE6 will still be valid.

Once you are at that point, it's easy to debug any problems and then start making any adjustments/hacks that don't validate.

It's easy to determine what browser is being used (assuming it's sending the correct user agent) with PHP if you can use server side programming, or alternatively with JavaScript on the client side, and then you can load a specific stylesheet on top of a regular stylesheet for each browser. IE6 and 7 have HTML hacks that don't require any extra work to load specific stylesheets for them, but there isn't anything available for the Gecko, Webkit or Presto browsers (Firefox, Safari/Chrome or Opera) so an alternate method is needed for anything specific to these browsers.

Matt
A: 

I think validating your pages is a good thing, however there are a few myths around this.

Firstly, you probably don't want to be doing XHTML, as you are in variably serving it incorrectly to browsers. Stick with HTML 4.0 Strict.

Secondly, having valid pages is nice, and useful, but don't beat yourself up over it, and don't validate other people's pages -- some people really enjoy this, and it only ever comes across as mean.

Finally, try to 'fill' the text in your pages so that your lines are not hugely long. It is unrelated to validating, but helps a human reader of your HTML.

mattl