|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
 |
|
|
05-03-2011, 05:53 AM
|
What's DOCTYPE for?
|
Posts: 12
|
Hi everyone,
I've seen websites without Doctype so I'm wondering, Does it matter what DOCTYPE to use? What if I don't use it, will it matter? Can someone tell me the purpose of it please, thanks.
|
|
|
|
05-03-2011, 06:15 AM
|
Re: What's DOCTYPE for?
|
Posts: 879
Name: Paul W
|
|
|
|
|
05-03-2011, 03:27 PM
|
Re: What's DOCTYPE for?
|
Posts: 10,228
Name: Giselle
Location: Washington State
|
Here's another Article on DOCTYPES you might find interesting as well.
|
|
|
|
05-05-2011, 02:09 PM
|
Re: What's DOCTYPE for?
|
Posts: 59
Name: Lisa Forgan
Location: Colorado
|
Doctypes are important. It is an instruction to the web browser about what version of the markup language the page is written in.
The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
There are various types of doctype: http://www.w3schools.com/tags/tag_DOCTYPE.asp
Just remember when you have no define doctype, then you will be in quirks mode and some problems may develop:
- (Quirks mode refers to a technique used by some web browsers for the sake of maintaining backward compatibility with web pages designed for older browsers, instead of strictly complying with W3C and IETF standards in standards mode. en.wikipedia.org/wiki/Quirks_mode)
|
|
|
|
05-06-2011, 05:31 AM
|
Re: What's DOCTYPE for?
|
Posts: 12
|
thank you so much everyone, this forum is great! I'm learning a lot. Thanks for being so accommodating with my questions.
About html5, it's seems html5 looks awkward in some browsers, what do you suggest...should I be using it or better stick to html4?
|
|
|
|
05-06-2011, 08:28 AM
|
Re: What's DOCTYPE for?
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
Realistically until IE8/IE9 supports more HTML5 elements 4.01 is "safest".
http://wufoo.com/html5/
Earlier IE browsers will be in "quirks mode"
MS should have a new slogan for their browsers.
"Internet Explorer by Microsoft - Holding web developement back by a decade"
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
05-09-2011, 05:17 AM
|
Re: What's DOCTYPE for?
|
Posts: 249
Name: octavian
Location: Bucharest
|
a DOCTYPE that is respected provides you 'code safety'. You will know what's wrong when you have a problem and, if everything it's valid, it's just a CSS problem (you will be 99% sure of this). If you don't have a valid document you will hardly control unclosed tags or other problems... especially when you have big HTML pages.
Quote:
MS should have a new slogan for their browsers.
"Internet Explorer by Microsoft - Holding web developement back by a decade
|
Well... I think they should also make mixers, TVs and refrigerators.
|
|
|
|
05-09-2011, 05:46 AM
|
Re: What's DOCTYPE for?
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
Well you must know the old joke:
If Microsoft made cars
Quote:
1. For no reason whatsoever your car would crash twice a day.
2. Every time they repainted the lines on the road you would have to buy a new car.
3. Occasionally your car would die for no reason, and you would just accept this, close all the windows, restart and drive on.
4. Occasionally, executing a maneuver such as a left turn, would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.
5. Only one person at a time could use the car, unless you bought “Car95″ or “CarNT.” But then you would have to buy more seats.
6. The oil, water temperature and alternator warning lights would be replaced by a single “general car default” warning light.
7. The airbag system would say “Are you sure?” before going off.
8. Occasionally for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key, and grab hold of the radio antenna.
9. Every time new model was introduced buyers would have to learn how to drive all over again because none of the controls would operate in the same manner as the old car.
10. You’d press the “start” button to shut off the engine.
|
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
05-13-2011, 05:22 AM
|
Re: What's DOCTYPE for?
|
Posts: 12
|
you are awesome Chris!
I needed a laugh and you made it possible
Most probably, eliminating compatibility issues in browsers is the main goal of DOCTYPE?
|
|
|
|
11-16-2011, 12:44 AM
|
Re: What's DOCTYPE for?
|
Posts: 27
|
Thanks! Not sure why one of the leading open source CMS products is doing it this way. Must be a reason. Anyone have any ideas?
|
|
|
|
11-16-2011, 12:56 AM
|
Re: What's DOCTYPE for?
|
Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
|
Quote:
Originally Posted by PickleWabbit
you are awesome Chris!
I needed a laugh and you made it possible 
|
Yeah, we all laugh at Chris around here....
Quote:
Originally Posted by PickleWabbit
Most probably, eliminating compatibility issues in browsers is the main goal of DOCTYPE?
|
No, the main goal of the DOCTYPE is to tell the browser what it's reading so it knows how to parse the page.
Without a DOCTYPE, your mileage may vary in how the page displays; some browsers are better than others at interpreting the page than others without the explicit declaration. Internet Exploder is the worst at it.
What I have been doing is using a HTML5 DOCTYPE and XHTML Strict syntax. The beauty of it is that works because HTML5 is backward compatible that way. Seems to work pretty well. As support becomes broader for what else HTML5 can do (and as I learn to implement it) I can add it.
tim 
|
|
|
|
11-16-2011, 08:50 PM
|
Re: What's DOCTYPE for?
|
Posts: 168
Name: James
Location: Australia
|
I object to having the need to have a doc type tag.
They where not in when I started, and I never use them. Mostly by habit, but also because I can only see one version of HTML.
Given that all old and redundant tags must retain supported anyhow, and that the only change from one version of HTML to the next is the addition of brand new tags. In theory, any website should work in all modern browsers.
__________________
** Directory of my other websites ***
Please login or register to view this content. Registration is FREE - for screen devices
Please login or register to view this content. Registration is FREE - for mobile devices
|
|
|
|
11-17-2011, 04:26 PM
|
Re: What's DOCTYPE for?
|
Posts: 919
Name: Scott Kaye
Location: Ontario
|
Without repeating what anybody else has already said (I'm late to the party), try running a margin:0px auto; css code on a div, or something similar, without a DOCTYPE. You'll see that it won't work, but with a DOCTYPE, it will.
DOCTYPES tell the browser what type of code the document is. It's the DOCument's TYPE.
|
|
|
|
11-17-2011, 06:10 PM
|
Re: What's DOCTYPE for?
|
Posts: 168
Name: James
Location: Australia
|
I was wondering why those Auto things did not work.
But, If a browser was to encounter a keyword to that point, then it must understand what that keyword means. It can only mean one thing no matter what the doctype says.
I understand with Javascript, you have a risk that a new keyword may have been used as a variable in an old webpage. Or when you merge two standards together where they both share one same tag.
But other than that, 99% of the HTML and 99.9% of CSS, should only have one version or one meaning of that keyword.
Sorry I will continu this later. My blood is still boiling from a nasty fight on facebook, and can not focus. I shall give this quality thread and its website due respect and continu with this post later.
__________________
** Directory of my other websites ***
Please login or register to view this content. Registration is FREE - for screen devices
Please login or register to view this content. Registration is FREE - for mobile devices
|
|
|
|
11-17-2011, 08:31 PM
|
Re: What's DOCTYPE for?
|
Posts: 919
Name: Scott Kaye
Location: Ontario
|
True. Although yes, margin:0px auto; should only mean one thing, and it means only one thing to us humans, the computer doesn't know what it is. It's just a string that can be parsed, somehow. I couldn't put
Code:
<div href="margin:0px auto;">center</div>
, because margin:0px auto isn't a valid URL. The parser is looking for a URL within an href attribute. The same goes for the entire document. If you don't specify a DOCTYPE, it's like telling the parser
Code:
<div margin:0px auto;>umm?</div>
. It might work in some browsers, if it assumes that the lack of an attribute tag is style, but not all. Similarly, all browsers assume that a .html or something similar is going to be HTML, but that doesn't stop me from using XML in a .html file. It just won't work.
Sorry if I'm a little unclear right now, too. I'm scattered, as always.
|
|
|
|
11-18-2011, 08:05 AM
|
Re: What's DOCTYPE for?
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
Unrelated question:
Quote:
|
My blood is still boiling from a nasty fight on facebook, and can not focus.
|
Why do people get annoyed by posting on Facebook.
You have a choice - You either lower yourself to the level of idiot and continue a verbal (text) battle with an "unkown person" or close your browser.
I am always amused/amazed at people who whinge and moan about being told the truth about themselves in forums (usually by me)
Hey they know they are stupid and childish, I know they are stupid and childish, so why do they need to continue proving it??
Anything that anyone "says" to me in the "virtual world" that is deemed to be insulting is pretty much ignored or will only lead me into questioning their intelligence level and or their maturity, which for some strange reason seems to irritate them even more.
I mean let's face it is pretty dumb behaviour to be infuriated by someone you don't know, don't care about and can simply ignore as if it was somebody's "darling" pet pooch sha**ing your leg.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
11-20-2011, 07:12 PM
|
Re: What's DOCTYPE for?
|
Posts: 168
Name: James
Location: Australia
|
Ok, it was somewhat off topic for me to state the facebook thing.
To: Physicsguy,
If you wanted to use inline CSS, the standards require that you have it following 'style= and to put it inside quotation marks.
A browser should see a href tag as a link tag as you said. That is just not the place to put a line of CSS.
__________________
** Directory of my other websites ***
Please login or register to view this content. Registration is FREE - for screen devices
Please login or register to view this content. Registration is FREE - for mobile devices
|
|
|
|
11-20-2011, 10:09 PM
|
Re: What's DOCTYPE for?
|
Posts: 919
Name: Scott Kaye
Location: Ontario
|
Quote:
Originally Posted by TRANZIT JIM
If you wanted to use inline CSS, the standards require that you have it following 'style= and to put it inside quotation marks.
A browser should see a href tag as a link tag as you said. That is just not the place to put a line of CSS.
|
Exactly 
|
|
|
|
11-21-2011, 02:01 AM
|
Re: What's DOCTYPE for?
|
Posts: 583
Name: Tony
Location: Seattle Washington
|
Quote:
Originally Posted by chrishirst
Unrelated question:
Why do people get annoyed by posting on Facebook.
|
It's because Facebook is important to them. When you're on Facebook, you're not anonymous, you are representing yourself. If you look stupid in real life, you put a negative on your personal image. Same goes for Facebook and your image.
Then it goes into the theory of you not being yourself online because you're behind a computer... which leads to another theory, which goes on and on. Point is- people react differently when they have something to lose. I have screen shots of users cussing me out and telling me how much they hate me. It's just amazing how they thought they could affect me... I laughed.
Sorry- off topic.
|
|
|
|
|
« Reply to What's DOCTYPE for?
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|