SitePoint Sponsor |
|
User Tag List
Results 1 to 14 of 14
Thread: Page Type
-
Jan 4, 2009, 13:15 #1
Page Type
Hello all,
I have been in web designing for last few years. But still I am not able to get by heart this line.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Can any body has trick to remember?
-
Jan 4, 2009, 13:18 #2
- Join Date
- Apr 2006
- Location
- Maryland
- Posts
- 1,838
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
On around 99% of pages using an xhtml dtd such as the one above, the page itself is sent as 'text/html' meaning you're not utilizing the benefits of HTML. The DTD only serves to remind the browser to render the page in standards mode.
Some text editors can make a blank html page with an auto DTD and such - for VIM I have a special function which makes an html page with a dtd, blank script element and body.
I would advise you to not use that dtd and go instead with an Html 5 dtd:
Code:<!doctype html>
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-
Jan 4, 2009, 14:27 #3
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
Unless you have a specific reason to use a different DTD you should be using the HTML 4.01 strict DTD as that is the current standard for web pages.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
Jan 4, 2009, 17:34 #4
-
Jan 4, 2009, 20:03 #5
- Join Date
- Nov 2008
- Posts
- 65
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I keep a basic HTML template in a very easy to access location on all my computers. The template has a doctype declaration, the required elements to validate against that docytype, a meta element to declare character encoding, and a lang attribute on the html element to declare the human language.
When I need to create a new document, I just make a quick copy of that file and get started.
However, good luck if you decide to memorize it
The doctype declaration also tells most validation services what type of markup you're using. If you change it, you'll also have to adhere to different markup rules if you like to validate your pages.
-
Jan 5, 2009, 03:43 #6
- Join Date
- Jan 2004
- Location
- The Kingdom of Denmark
- Posts
- 2,702
- Mentioned
- 7 Post(s)
- Tagged
- 0 Thread(s)
With Windows, you can create an HTML template, which you can then access from the right-click menu. I assume you can do something similar with other systems.
-
Jan 5, 2009, 06:51 #7
- Join Date
- Oct 2008
- Location
- Whiteford, Maryland, United States
- Posts
- 13,782
- Mentioned
- 16 Post(s)
- Tagged
- 0 Thread(s)
Me? No. It's kinda hard to remember something that long. Remember the 4 parts to a DTD.
!DOCTYPE-The identifier. It indicates to the user-agent that the enclosed information will define the type of document of the page.
HTML-The Top Element. This tells the browser what element to expect as the top-level element. For HTML and XHTML documents this element would be <html>
PUBLIC-The Availability. The most common DOCTYPES you will use will be publicly available - "PUBLIC". But you can also specify a local DTD with the "SYSTEM" key word.
"-//W3C//DTD HTML 4.01 Transitional//EN"-The Formal Public Identifier. This entire string is what identifies the DOCTYPE.Always looking for web design/development work.
http://www.CodeFundamentals.com
-
Jan 5, 2009, 20:04 #8
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
Since that line always has that exact value there is no need to remember it, just copy it from one page to the next along with the rest of your template code.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
Jan 5, 2009, 22:19 #9
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Jan 6, 2009, 12:02 #10
- Join Date
- Jul 2008
- Location
- New York, NY
- Posts
- 1,432
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Copy and paste as the others have said.
Unless you are using real xhtml, I would use the HTML 4.01 strict DTD.
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Here are some good links to help you with your decision:
http://www.sitepoint.com/forums/showthread.php?t=393445
http://www.sitepoint.com/forums/showthread.php?t=428205
-
Jan 6, 2009, 16:26 #11
- Join Date
- Oct 2008
- Location
- Banned
- Posts
- 506
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What I do in PHP is include one file that contains all the variables and constants for my entire site. Then after I include the file with PHP I just echo the doctype variable and BAM. The doctype is included in the page and can be included in every page. Must easier IMO. If you ever want to change the doctype then just edit that one variable and the entire site changes.
Cheers
-
Jan 6, 2009, 17:50 #12
- Join Date
- Jan 2004
- Location
- The Kingdom of Denmark
- Posts
- 2,702
- Mentioned
- 7 Post(s)
- Tagged
- 0 Thread(s)
Why just the DOCTYPE? I rarely need to change anything above the <body> tag, except the title, so I make a simple template file and load the title into this. Depending the the design, I can usually even get away with including even more in the header. Most of my headers are something like this:
Code php:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title><?php echo $title;?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="screen.css" type="text/css" media="screen"> <link rel="stylesheet" href="print.css" type="text/css" media="print"> </head> <body> <div id="contents"> <h1><?php echo $title;?></h1>
-
Jan 6, 2009, 18:02 #13
- Join Date
- Oct 2008
- Location
- Banned
- Posts
- 506
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I was simply making an example...You can of course do that but most times I have to change the title variable so much that it is so much more useful to do what I want.
:/
-
Jan 8, 2009, 05:40 #14
- Join Date
- Aug 2007
- Location
- Netherlands
- Posts
- 10,287
- Mentioned
- 51 Post(s)
- Tagged
- 2 Thread(s)
Christian:
Each of my pages not only have a different title, they have a different description meta tag, and pages with submit forms (are supposed to) have the no-cache, no-store tags.
Also, some of them have different CSS references depending on what I'm doing. If I have a light-dark selection for users, then the back-end language will have to replace the CSS link in the head. Also my one-off pages which have their own internal CSS have different heads (pages where there's no point in having 2 GET requests when the CSS is only for that particular page, such as my hover maps-- the specificity gets too crazy to lump them into the regular CSS).
And, on one set of sites, the Doctype isn't even the same-- to get around caching problems re forms, I was forced to use target="blank" on some in-form links. So those pages get a transitional doctype while I'd rather the rest of my pages get the Strict one.
Bookmarks