Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPdate doc type

Status
Not open for further replies.

oaklandar

Technical User
Feb 12, 2004
246
US
Advise if the below doctype is old and should I update it?
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;>

If I should update it what would be the equivalent and what exactly does the doc type do?

It seems to have problems with Netscape 7 but works great for me in Netscape 4.77 and IE 5.5
 
Personally, I use this:

Code:
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1 Strict//EN&quot; &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;>[/URL]

Dan
 
A doctype tell the browser what kind of HTML is on the page (the HTML spec version is you will). The browser then knows what tags/attributes to look for and what rules it should use to render them. You should use the doctype that accurately describes the version of HTML that is on the page. If you don't, your content many not be rendered properly and the browser will have to do extra work in order to figure out how to deal with the discrepancy.

Here is a list of available doctypes:


To make sure you are using the right doctype, validate your site using a validator like this:

 
Your DOCTYPE does nothing actually. If you do not provide a link to the doctype in the declaration (like Dan's example shows), the entire declaration is simply ignored. If a correct url is given, your code will be rendered according to that doctype (gives you more uniform look on different browsers).
 
What if I am on a network that can not access the a link to the doctype such as this:
Code:
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1 Strict//EN&quot; &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;>[/URL]
? What doctype would I then use?

Also what you saying is that my current doc type is not working at all?
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;>
 
&quot;A recent DOCTYPE that includes a full URI (a complete web address) tells these browsers to render your page in standards–compliant mode, treating your (X)HTML, CSS, and DOM as you expect them to be treated.

Using an incomplete or outdated DOCTYPE—or no DOCTYPE at all—throws these same browsers into “Quirks” mode, where the browser assumes you’ve written old-fashioned, invalid markup and code per the depressing industry norms of the late 1990s.

In this setting, the browser will attempt to parse your page in backward–compatible fashion, rendering your CSS as it might have looked in IE4, and reverting to a proprietary, browser–specific DOM. (IE reverts to the IE DOM; Mozilla and Netscape 6 revert to who knows what.)&quot;

More at:
 
Thanks, I can only assume that &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;&gt;
is out of date for what I am trying to do in Netscape 7.
 
Re: URL

QUOTE: In Internet Explorer, a DocType comment—a document-type declaration tag that dates back to early Standard Generalized Markup Language (SGML)—placed at the top of your HTML page tells current browsers how to deal with old and new code alike.

There is no mention of a requirement for a URL?!

Here's just one example found on MSDN and it has no URL.

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Frameset//EN&quot;&gt;

Here's one I coppied from the source for a page I just happened to have open at Mozilla.org

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;

The latter is the most common doctype declaration currently in use: 4.0 Transitional specifies to use HTML with the XHTML syntax (i.e. every tag having a [ignore]/&gt;[/ignore])

----------
I'm willing to trade custom scripts for... [see profile]
 
In my experience it doesn't make a blind bit of difference.

Example: On one occation I actually wanted the original layout style for IFRAME but the browser didn't care what DOCTYPE was used and continued to render it in it's default style :/

----------
I'm willing to trade custom scripts for... [see profile]
 
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;
This was the best doctype for me to use because for some strange reason it doesn't break the tables in Netscape 6.x whereas:

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;
seemed to create funky spaces in sliced and diced image type tables
 
As vragabond says, in order for your chosen DOCTYPE to &quot;work&quot; and trigger the browser to work in standards-compliant mode you need to write this:
Code:
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;[/URL]
As to whether it is &quot;old&quot; or not: well, it's older than some possibilities and newer than others. It doesn't really matter as long as browsers understand the language in question (and that's likely to be a VERY long time).

To take a rather extreme example: if you speak to me in Latin, and I understand it, does it matter that the language is old?

-- Chris Hunt
 
If the URL matters, then we need a complete list of all the possible URLs and what they mean.. where can I get such a list?

----------
I'm willing to trade custom scripts for... [see profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top