Is the DOCTYPE thing necessary?

  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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>
  • techwiz
  • Beginner
  • Beginner
  • User avatar
  • Posts: 46

Post 3+ Months Ago

Only if you validate, It is just another way of identifying what type of code your site is.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

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.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

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 ...
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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.
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Posts: 575
  • Loc: Phoenix, AZ

Post 3+ Months Ago

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

...including your own.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

Hello, my name is
XHTML 1.0 Strict
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida
  • jameson5555
  • Bronze Robot
  • Bronze Member
  • User avatar
  • Posts: 575
  • Loc: Phoenix, AZ

Post 3+ Months Ago

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.
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

Thanks, guys ^^
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

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
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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.

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 36 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.