What's the code at the very top of every HTML document?
Asked by
Link (
327)
April 9th, 2009
What’s the code at the very top of every transitional HTML document? What does it mean? Is it absolutely needed? Don’t be shy with the detail folks. Thanks.
Observing members:
0
Composing members:
0
14 Answers
You mean the namespace declaration?
Any chance you could copy & paste an example here?
<!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
You mean that one? It defines the document type in XHTML (EXtensible HyperText Markup Language). It can be Strict, Transitional, or Frameset, and it basically defines the rules for the code on the page. Use strict for the cleanest code using CSS for presentation. Transitional is good if you want clean code, but still want to use some HTML presentation stuff. Frameset is for when you want to use HTML frames.
<!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en”>
Absolutely needed? not so much in html
@larsalan Right. It is not needed in HTML, but it is a requirement for XHTML.
Okay so it’s the same code every time? And it’s needed in every XHTML document?
Oh and by the way the code that LARSALAN provided is different than the one RU2BZ46 provided. Which one of you guys got it right?
@Link They are both the same, but I did not include the <html> tag with the namespace attribute. It is the same code every time, but there are options (strict, transitional, frameset). There is a good basic (free) course on XHTML at http://www.w3schools.com/xhtml/default.asp, which can answer most of your questions in less than an hour.
@link use ms frontpage or adobe dreamweaver and don’t worry about it.
p.s. don’t buy either TPB ftw!
Thanks again dudes. Right now I’m using QuarkXPress8 to design my sites. The first site came out so-so, but no major issues. A lot of people have told me that it’s better to know HTML so I’m learning it at www.w3school.com. I’m also learning it on Lynda.com which has been helpful.
@Larsalan, what is TPB ftw? lol
@Link
http://thepiratebay.org/ forTheWin
have you tried drupal or joomla? they are not the same as designing your own html pages, or so I’ve heard. They say drupal is user friendly and it’s open source!
No I’m using QuarkXPress 8 and Notepad ++. Drupa and Joomal are WYSIWYG?
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.