Is the DOCTYPE thing necessary?

  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post July 1st, 2008, 6:28 am

For example, like this
Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">

that goes bfore the <head>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 1st, 2008, 6:28 am

  • techwiz
  • Beginner
  • Beginner
  • User avatar
  • Joined: Dec 31, 2007
  • Posts: 46
  • Status: Offline

Post July 1st, 2008, 6:43 am

Only if you validate, It is just another way of identifying what type of code your site is.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6129
  • Loc: Seattle, WA
  • Status: Offline

Post July 1st, 2008, 6:53 am

It indicates to the browser how to render the page. If you leave off a doctype, your browser will render everything in "quirks mode", which causes a lot of hassle and headache when trying to design pages correctly, especially for cross-browser compatibility.
The Beer Monocle. Classy.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 1st, 2008, 7:43 am

spork wrote:
It indicates to the browser how to render the page. If you leave off a doctype, your browser will render everything in "quirks mode", which causes a lot of hassle and headache when trying to design pages correctly, especially for cross-browser compatibility.

ditto ... I think it's a designer's friend ... and a browser's ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post July 1st, 2008, 10:21 am

You can think of it like wearing a name tag which includes your job title at work, while it's entirely possible to get through the day without it, it makes everyone elses life easier if you wear the correct one.
Strong with this one, the sudo is.
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Joined: Oct 02, 2007
  • Posts: 575
  • Loc: Phoenix, AZ
  • Status: Offline

Post July 1st, 2008, 12:14 pm

joebert wrote:
it makes everyone elses life easier if you wear the correct one.

...including your own.
phoenix web design
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6129
  • Loc: Seattle, WA
  • Status: Offline

Post July 1st, 2008, 12:21 pm

Hello, my name is
XHTML 1.0 Strict
The Beer Monocle. Classy.
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post July 1st, 2008, 2:54 pm

Wow.. so then how should I know what HTML exactly I'm using to put in the code?
And another thing I can't figure out is what are these site-like things in it. I looked up the doctype thing practically everywhere but nowhere it's explained in detail.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post July 1st, 2008, 3:13 pm

Strong with this one, the sudo is.
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Joined: Oct 02, 2007
  • Posts: 575
  • Loc: Phoenix, AZ
  • Status: Offline

Post July 1st, 2008, 3:16 pm

They explain doctypes pretty well here.

You basically get to decide which doctype you want to use. Personally, I like to use strict whenever I can, but a lot of people use transitional, too, which is perfectly ok.
phoenix web design
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post July 1st, 2008, 3:51 pm

Thanks, guys ^^
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post July 1st, 2008, 4:00 pm

Just one last question. Is it OK if I use a transitional given that I still use stuff like <div align="center"> and <font>?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post July 1st, 2008, 9:04 pm

It's okay to use transitional... but using inline or external CSS would be better than using attributes... but it's up to you... I guess inline CSS is about the same as attributes... just more correct I guess.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6129
  • Loc: Seattle, WA
  • Status: Offline

Post July 1st, 2008, 9:14 pm

Long story short, you can use both <font> and <div align=...> with a transitional DOCTYPE, but you shouldn't. Both of those are deprecated as of HTML 4.01/XHTML 1.0.

http://w3schools.com/tags/default.asp
The Beer Monocle. Classy.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8922
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 1st, 2008, 10:08 pm

HKt0p5 wrote:
Just one last question. Is it OK if I use a transitional given that I still use stuff like <div align="center"> and <font>?


I would get in the habit of not using font, it will actually be easier for you to write your html and do your styling without using depreciated tags like that, plus your HTML will look much nicer. You can absolutely use div tags, but you would be better off using CSS for the centering. Sometimes it is hard for people to transition to new things if they are comfortable with something already, but if you do put a little time into it and learn the better way you will actually see its much easier without tags like font. I try to do all of my styling with CSS as it is much easier to change the look of a website then. For example with Ozzu you can see the forum in the light theme or the dark theme. The HTML is identical on both, the only difference is a few changes in the CSS. With font tags I would have had to change a great deal of HTML to make both the light and dark theme.

With doctypes I tend to use the more strict version (of whatever type I am using, HTML 4.01 in this case) first and then fall back to transitional only if I have a good reason. The main reason Ozzu is using transition is because on links target="_blank" is not valid with the strict doctype, and I use that for external links. I would strongly suggest you use a doctype as others have suggested because you will be using quirks mode otherwise which will probably cause all sorts of issues for you.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 1st, 2008, 10:08 pm

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 130 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.