Page 1 of 1
Document types and validation?
Posted: Wed Dec 19, 2007 3:00 am
by Sindarin
Well I've seen lately a rage to create pages with valid html, css etc. and usage of document types (strict/transitional). My questions are, what is the use of document types?
I've used them a bit and saw minor changes in my design, but apart from that I can't understand what might be great about them, and secondly about html,css validation, everyone's adding "Valid HTML!", "Valid CSS!" tags on their website, but why the user should be concerned? Does it have any significant impact on how the page is displayed?
I've tried to Google for reasons why I should be using doctypes and having valid html, but the one I came up with is that "you should do it".
Posted: Wed Dec 19, 2007 5:34 am
by shiznatix
It makes the browsers job a heck of a lot easier if everything is valid. If it is valid, your page will render the same across all browsers that adhere to standards (basically all but IE). So really, code to standards and it will make your users expierence better with a faster page load and it won't matter what browser they are using. Also, this will make it easier for any developer to be able to edit your page without breaking it, even if the developer is still you. If you just use tag soup without caring about standards, you will hate yourself when you have to go back and edit it and you also won't be able to advance since you will be stuck in "your way" while the standards say that it is now going to happen another way.
As for the IE flaws, do everything correct to standards then check it in IE. If IE decides to be silly, google for the problem or ask here and there is almost always a work-around that will still let your pages validate 100%.
Posted: Wed Dec 19, 2007 5:43 am
by s.dot
Future compatibility with browsers.
Posted: Wed Dec 19, 2007 8:28 am
by matthijs
We do it so we can place those cool badges on our sites
(just kidding, there was a time it was cool, but not anymore)
Posted: Wed Dec 19, 2007 9:12 am
by Inkyskin
There are other reasons too - if someone is using a screenreader for example, valid code will make it much easier for the software to read the page, and find details for elements, such as alt tags for images etc. It can also help on an SEO front - having the orrect tags, markup etc can help spiders determine what information you have to offer more easily.
Re: Document types and validation?
Posted: Tue Jan 15, 2008 3:30 pm
by Sindarin
I see now, however is very hard to create a valid & truly functional page. Take for example the ie6 png hack, for the sake of one browser the page does not validate. Well, it figures when Microsoft's site has already numerous validation errors.

Re: Document types and validation?
Posted: Thu Jan 17, 2008 10:29 am
by matthijs
I don't think creating valid pages is hard. The validation tool tells you exactly what the errors are and how to solve them.
If you are concerned with hacks making your code invalid (like the png hack), you can use conditional comments and place all invalid stuff in a IE specific stylesheet. If that doesn't validate, well, blame Microsoft.
Remember, validating a site is not a goal. At least not for me. It is a means. Validating is a very useful tool to help you write good code. Code which you can trust, that it will work in modern and future browsers and devices. that's all.
It's the same as having strict error reporting on. Each warning or notice tells you something is wrong or might cause problems.
Re: Document types and validation?
Posted: Wed Mar 05, 2008 10:38 pm
by Ambush Commander
Semantic markup, IMO, is far more important.
Oh, and the buttons are absolute bosh.
Re: Document types and validation?
Posted: Thu Mar 06, 2008 10:21 am
by pickle
DOCTYPEs tell the browser what kind of document it's displaying. Without a declared document type, browsers usually render a page in "quirks mode", which is basically a bunch of hacked rules thrown together to try & get all pages to display somewhat properly. With a declared DOCTYPE, most browsers render a page in "standards mode" which is a more standards-compliant mode. The different rendering engines are what cause the slight change in appearance.
For me, there are 3 reasons for making a page validate:
- Having standard code makes all pages much easier to read source code-wise - there's no special cases or tricks & everything is in plain sight.
- Valid code is a sort of baseline that all browsers should know how to handle. If the code is not valid & is tweaked for a particular browser, then all users without that particular browser will likely show a more messed up page than if the page validated.
- Its a badge of professional honour to say I build valid pages. Anyone can throw together a webpage - that's what Frontpage was made for. It takes someone who is at least somewhat skilled in their craft to make a valid page.
Re: Document types and validation?
Posted: Thu Mar 06, 2008 11:01 am
by Inkyskin
The way I look at it is this: If you were to build a house, and ignore law on the way it should be built, it'll likely break apart and fall to peices. If you follow regulations, it'll most likely stand up for a long long time.
Whats the point in programming if your not going to do it properly? If your not doing it to a standard, your not really programming at all, your just hacking together scrappy code.
Admittedly none of your visitors know what valid html is, but when they see things like "Coded in valid xhtml", they at least know that it's conforming to standards, and that who ever built it has taken pride in thier work.