![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
|
!DOCTYPE - What does this mean?
In my book on PHP, it allways starts a section of code, as if it were starting the page of code, with the fallowing:
<!DOCTYPE html PUBLIC
"=//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">and it never expains what that means, yet it's in each example of code. im going to guess DOCTYPE is the type of the document, but yet with the ! operator, which is 'not,' right? So im guessing it's saying 'not an html public document.' However im lost after that. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
The ! just means "I'm a special type of tag! Look at me!" in this case. It isn't C - different language here.
And as always, Google is your friend. |
|
|
|
|
|
#3 |
|
Programmer
|
i also want to know what the whole thing means as well, not just the !
|
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Then click the link...
|
|
|
|
|
|
#5 |
|
Programmer
|
The "DOCTYPE" tag is the "DOCument TYPE" you want the webpage to be rendered in.
Purposes include: Helping you validate your site at http://validator.w3.org And to change the "mode" of your browser: Firefox, and I assume quite a few other browsers, have two modes:
If you choose to use mode 1, Standards Compliance Mode, you need to specify the Document Type you are complying to. That is, if you code a proper website, you are using a Standard Compliance Mode. This causes Firefox to render the site according to the specification of that language, and won't render glitches (referred to as (rendering) "quirks" in the browsers). Now, if you use mode 2, Quirks Mode, you are telling the browser to allow glitches/hacks to be used to render a site the way IE would render it. Or at least, close to it. Example of a quirk: Back in the day, there were websites, that upon loading, would fade from black to white, then display the website content. This was a quirk found in the Netscape browser of old, and many personal websites (and even some professional) would use it to add "style" to their site. How was this accomplished? Take a look at this code below: [php]<html> <head> <title>My Website</title> </head> <body bgcolor="#000000"></body> <body bgcolor="#111111"></body> <body bgcolor="#222222"></body> <body bgcolor="#333333"></body> <body bgcolor="#444444"></body> <body bgcolor="#555555"></body> <body bgcolor="#666666"></body> <body bgcolor="#777777"></body> <body bgcolor="#888888"></body> <body bgcolor="#999999"></body> <body bgcolor="#AAAAAA"></body> <body bgcolor="#BBBBBB"></body> <body bgcolor="#CCCCCC"></body> <body bgcolor="#DDDDDD"></body> <body bgcolor="#EEEEEE"></body> <body bgcolor="#FFFFFF"> <h2>My Website</h2> <p>Check out my cool website! The background fades from black to white!</p> </body> </html>[/php] I used the PHP vB code in order to get the HTML colored right. So disregard the "PHP Code:" thing. Anyways, what Netscape would do in that instant, is read the page from top to bottom. It would see a body tag that had a background color of black, and so it would render that, but then the body would close, and another color would have to be rendered. Cool, huh? Either way, that "quirk" has long been dead. And I bet Firefox's quirk mode won't support it either. I just needed to show an example of what a quirk is, in order for you to see what I mean. Now, the proper way to code, is, of course, to use Standard Compliance Mode, to comply with the World Wide Web Consortiums documentation on how HTML should be rendered and written. So, all in all--this was an exhaustive post to help you gain a little insight as to why DOCTYPE exists and what it's mainly used for. Did you catch any of that? :p
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#6 |
|
Programmer
|
read it all twice, thanks!
|
|
|
|
|
|
#7 |
|
Programmer
|
Oh, and I guess I forgot to mention that if you specify a DOCTYPE, you are saying that website needs to be rendered for that type using Standards Compliance Mode, but if you don't specify a DOCTYPE, it assumes Quirks Mode.
But I guess that was implied. :p Now, for something cooler: The Firefox Web Developer Extension This is an extension to the Firefox browsers, which provides you with a toolbar that lets you do tons of things to the websites you work on, in order to help you designer faster and cleaner. Here is a quick list of features it provides you with, all at your fingertips.
And a whole lot more! Now the cool thing is, on the right side of the toolbar, you will see a blue circle with a check mark inside it. If it's faded, the site is being rendered in "Quirks Mode". If you click the check mark/cirle, it will even say so, along with some other information about it. And if the check mark/circle is nice and blue (i.e. not faded) then it's in Standards Compliance Mode. Pretty nifty, isn't it? And if you're not using Firefox... then you better get started NOW! Also, there is an an IE View extension, which allows you to quickly open the site your viewing in IE. This helps when you're designing a XHTML/CSS site, and you need to check if IE is rendering things like Firefox, or if you'll need to modify your markup (or add PHP code) to compensate for rendering issues. Anyways, hope that was of help to you, and any others that read this thread. ![]()
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|