Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Max

<Doctype Html>

Recommended Posts

Not closing a tag like <br> is only a violation in XHTML, not HTML (even when the strict doctype is used).

Also, all versions of (i.e., doctypes for) HTML will allow you to use deprecated tags, but you'll probably get a warning in the validator that you're using a deprecated tag.

 

The important thing to understand is that regardless of what the W3C validator says, whether a tag can be used is completely up to the makers of the browser being used, (and as far as I know), all browsers still currently support deprecated tags, meaning that regardless of the doctype you specify (even the strict one), deprecated tags can be used.

Share this post


Link to post
Share on other sites

Not wishing to over-egg the pudding, but ever since the first day that I started to learn html, I learnt that the www consortium was the paragon, the benchmark, of all things hypertext.

I studied html using Maria Castro's book and the W3 schools web site. So....shouldn't W3schools be using html5? Currently it is:..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML lang=en-US>

I can understand why they don't use strict as they need to teach deprecated tags in the lessons (e.g. target = "_blank"), but why not xhtml?...or html5?

Share this post


Link to post
Share on other sites

Well, I think the basic answer is that W3Schools is not a very good representative for how things should be done. They make understandable answers, but do many things wrong, even in their answers.

Share this post


Link to post
Share on other sites

That's a bit worrying, Larry, as I have used them in the past as the final arbiter of html. What web site (apart from this excellent forum) would you recommend for first class advice and tuition?....And can you please do a textbook on html/css? Yes I know that there are many on the market but I would buy yours.

Share this post


Link to post
Share on other sites

Check out http://w3fools.com/ I'm not saying W3Schools is unreliable, but they aren't always the best. I use StackOverflow a lot these days.

 

I won't be doing an HTML/CSS book, but thanks for the suggestion!

Share this post


Link to post
Share on other sites

I agree with Larry that StackOverflow, while sometimes hard to understand, is probably the most reliable source of accurate, up-to-date information.

 

In my experience, the best way to learn about the details of HTML (or anything, for that matter) is to take it one step at a time. For example, in this topic, we've been discussing just the doctype, ad nauseum. Through discussions like these as well as checking out various online resources, you will eventually learn the idiosycrasies of the doctype definition inside-out.

 

After you understand the doctype really well, then you can move onto something else, etc., etc. That's basically how I've learned most of my HTML, CSS and JS over the years.

 

It's a somewhat unorganized approach, but to my knowledge, there is yet to be the end-all, be-all one-stop solution for all things Web development related. As such, you have to approach it in a piecemeal fashion.

  • Upvote 1

Share this post


Link to post
Share on other sites

As a side comment, W3Schools is a really good quick resource, but a ton of their examples are wrong/outdated/in poor form (and that's not even counting the fact that they prefer ASP over PHP).

 

As for the doctype discussion, I think the important thing to understand about the "HTML5 doctype" (as that's what everyone calls it) has one purpose: To make all browsers interpret the page in standards mode, not quirks mode. Beyond that, it serves no real purpose. In theory, yes, it has other purposes, but in reality, it's purely to avoid quirks mode, which will get switched to if no doctype is declared.

 

The HTML5 doctype does not actually enable HTML5 features nor does it help validate certain tags (unless of course you run your code through a validator like the W3C one).

 

All the same, as discussed before, the best approach is to use the HTML5 doctype, and then always write 100% valid HTML5 markup.

  • Upvote 1

Share this post


Link to post
Share on other sites

What you are saying HartleySan is that to put <!Doctype html......... will guarantee all browsers (even older ones) will drop into standards mode, but Larry says in his book that some browsers will drop into quirks mode even if there is a small error in the html. I'm getting more confused.

Share this post


Link to post
Share on other sites

I don't know all the details of what makes every browser go into quirks mode, but honestly, I think it's a moot point because you should always be striving for 100% valid HTML anyway, which isn't hard to do with the use of an HTML validator.

 

As long as you use the HTML5 doctype and always write valid HTML, your page will always be rendered in standards mode in all browsers.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...