Log in

View Full Version : CSS validation? What is that DOCTYPE thing?



dandylion
05-26-2008, 12:45 AM
I've been reading and working through a tutorial I got on the web, one of several, and I read this line of code that I am unfamiliar with:

<!DOCTYPE html PUBLIC "-//WC3//DTD HTML 4,01//EN">

I noticed one tutorial has one webpage address, another has another. What IS this wc3 thing? I know it is a webpage because I got a tutorial there, but what I don't understand is why I should have that or any other webaddress in the DOCTYPE thing. Do they have to validate my website? What are they there for?

And this whole validating thing, I am confused. I think I understand that there is a correct way that has been standardized to write code and all that but why call it validation? Does anyone have to validate my code? Is it a free thing? How do I test my code in other browsers? Just download other browsers to my own computer?

I guess I am just confused as to the term 'validation', it makes me instantly think that someone has to put a 'stamp of approval' on something like a meat packing plant :-)

Thanks
:-)

djr33
05-26-2008, 12:54 AM
wc3 is a group that sets standards and updates HTML. (http://www.w3.org/)

a doctype means "Document Type" and is very simple-- it's something you add to your page to change from the default mode*, and set what sort of rendering you want the browser to use. Then you can code your page with more accuracy in knowing what the visitor will see. *The default mode is basically letting the browser guess what sort of rendering you want, and that's usually unreliable and buggy.
You can pick HTML 4.0 loose, strict, XHTML transitional, or strict, etc.
Generally, at this point in time, HTML 4.0 strict will be the best. (XHTML isn't supported enough yet, and strict 4.0 will be better than loose/transitional.)

As for the "stamp of approval", I think it's pretty stupid. Validation is some arbitrary set of rules that aren't necessarily the best and, in fact, don't always even work in all browsers (especially internet explorer).
HOWEVER, and this is why it DOES make sense to use validation, it is a way to be as sure as possible that it will work across browsers.
It will set up a page that works if browsers handle accurate code. After that, you might have to make some changes, but it's a LOT easier to start there (or to ask questions here), when you have accurate code, than when you have random code based on your own personal set of standards.

Some people are obsessed with "valid" pages-- as I said, I think it's kinda stupid-- but it still does make sense to use it when possible, because standards make it much easier to deal with code and get help.

In other words, if you have a completely invalid page that does work across all browsers exactly as you want, then that's just fine. But the odds of that really happening are incredibly low. It'll be easier to just go with the standards.

I hope this gets you started.

sandyk3
05-26-2008, 12:59 AM
Hi,

I will leave some of your questions to the people on this board that have been coding longer than I have but I will help where I know I can.

You don't have to download other browsers to test your page. Go to:
https://browsershots.org - you can test your page there, for free, up to a certain amount of requests per day.

You should validate both your HTML: http://validator.w3.org/ and your CSS: http://jigsaw.w3.org/css-validator/ . You want to make sure you are using up-to-date code and not depricated code as one day your page may not render the way you want it to. Validating your code also tells your clients and whoever visits the sites you build that you care about good code.

Your questions about w3c - World Wide Web Consortium- a group of experts that develop web standards and guidelines.

I know others will have much more to say.

Sandy K

dandylion
05-26-2008, 02:40 AM
"You should validate both your HTML: http://validator.w3.org/ and your CSS: http://jigsaw.w3.org/css-validator/ . You want to make sure you are using up-to-date code and not depricated code as one day your page may not render the way you want it to. Validating your code also tells your clients and whoever visits the sites you build that you care about good code."

Ah, all right so 'validating code' DOES mean that you somehow check it. All right, now I am less confused. Is it some sort of online form that I just copy paste my code into and it checks it and says 'yeah or nahhhh'?

Right now I am working through a tutorial that I think is good about showing correct code and good, easy to understand, examples: http://www.davesite.com/webstation/css and before that I read a shorter tutorial from w3c.

Thanks guys, this makes more sense now. Though I am sure I'll have more questions as I learn more.

:-)

dandylion
05-26-2008, 02:42 AM
Thanks for your reply. Things are making more sense now though I am sure that I'll have more questions later.

"a doctype means "Document Type" and is very simple-- it's something you add to your page to change from the default mode*, and set what sort of rendering you want the browser to use. Then you can code your page with more accuracy in knowing what the visitor will see. *The default mode is basically letting the browser guess what sort of rendering you want, and that's usually unreliable and buggy.
You can pick HTML 4.0 loose, strict, XHTML transitional, or strict, etc.
Generally, at this point in time, HTML 4.0 strict will be the best. (XHTML isn't supported enough yet, and strict 4.0 will be better than loose/transitional.)"

Yeah, that makes a lot of sense. I did not realize that browsers did that, that really is good to understand. Thanks a bunch :-)




:-)

sandyk3
05-26-2008, 03:44 AM
As far as how to validate you can do it one of two ways. You can upload the html file to the site or you can upload your html/css files to your host and put your URL in the validator. Either way it will run your code and come back with either a page with a green bar stating your code validates or a red bar telling you it doesn't validate. When your page doesn't validate it will also let you know what your errors are and what line to find them in. You are also given code to put an image on your page to prove to your users that you validated but.. I think that is just too much. I think others will agree. There are those that want to put it on their page - to each his own.

Hope this helps and yell out any time in your journey for help. That's what this board is here for. They have helped me immensely!!!

Sandy K

ps.. i just got done with my first paying job -http://thegenesiscenter.net/
and it took me a long time to get there.. just don't give up!!!!

dandylion
05-26-2008, 03:56 AM
ps.. i just got done with my first paying job -http://thegenesiscenter.net/
and it took me a long time to get there.. just don't give up!!!!

Good work :-) I might have to get a job making web pages but the reason why I wanted to learn all this is so I could make my own webpage for my portraits. I am an artist. I know, I know, I could use a template, but after I get done fixing up a template I realize that I want my information a certain way and the template is not what I want. I have learned a bunch though just reading and altering the template code.

I like those colors on the page you made. Did you do the graphics also?

Good work :-)

:-)

sandyk3
05-26-2008, 05:09 AM
Thank you for the compliments. My friend Teri and I are a team and she did the graphics. On this next page though, I'm going to pick out the colors and when we don't have a rush job, I will be following her footsteps and helping with the graphics. She is a mentor to me and a really good friend.

The way you are setting out to learn is how I did. I started to modify some templates and found out that wasn't enough for me. I couldn't get the result I wanted. I checked out the tutorial you are doing and it looks pretty good. Here is another one: http://tizag.com/

about.com has good tutorial: http://webdesign.about.com/c/ec/30.htm

Feel free to email me with any questions!!
Good Luck!
san