-1

I'm thinking of learning (X)HTML. I have read on the web about w3schools and discussions on the subject and intend to stay away from it (or at most use it as a reference). I think it is best when learning programming languages to go to the original source (php.net, python.org, mysql.com, ...). I tried to read the (X)HTML 4/5 spec but gave up soon after starting. The next best thing as far as I can tell is the DTD. What are your opinions in this kind if learning and can you recommend alternatives? Also is there a DTD or something like a DTD for HTML 5 yet?

  • 5
    w3schools is not a good resource - see http://w3fools.com - also, a DTD is really not a good learning resource. – Oded Aug 24 '12 at 11:41
  • 2
    Reading the XHTML DTD could be compared to reading the C++ source code of PHP to learn it – I can't believe that this is good idea. – feeela Aug 24 '12 at 11:44
  • 1
    @Oded - Despite what w3fools may say, the majority of w3schools is great for quickly looking things up. Test their example first and, in most cases, things will work as expected. Also, the DTD can be very helpful when learning the details of everything but, until you are comfortable reading it, it can be daunting. – Rob Aug 24 '12 at 11:45
  • 1
    If you are going to test W3Schools examples then make sure you test them with: 1. Regular browsers. 2. Text browsers. 3. Screen readers. 4. Search engines. 5. Security penetration testing tools. (Not in order of priority). – Quentin Aug 24 '12 at 11:47
  • 1
    If you cannot understand the spec, there is almost no way you'll be able to understand the DTD. And HTML5 doesn't have a DTD. – BoltClock Aug 24 '12 at 11:54
  • @feeela: I disagree. The C++ source of PHP at least *may* explain a few more things about the language; and considering it's quality, that may be enough to use it. Well, even source of a random web browser could be better than DTD. – Michał Górny Aug 24 '12 at 15:12

2 Answers2

2

HTML is more than the DTD. Learning HTML from DTD is like learning C from include files — you just don't do it.

The DTD just specifies a few simple grammar rules. You can use it to roughly validate your code but it's limited. And it definitely knows nothing about semantics.

It's a guess-work. It's like, you have:

<html>
   <body>

and now the DTD only says you can choose one of: <h1>, <h2>, …, <ul>, <ol>, …, <p>, …

Well, sometimes it gives a brief description of what particular elements or attributes mean (in comments). But that's all. It doesn't explain what is the purpose of given element, what are the alternatives and which one should fit the particular task better.

Also, remember that HTML is rarely used alone these days. You at least have to know CSS as well (unless you're going to write some ugly soup — then please don't even start), and CSS is not fit for DTD.

The specs are the most important documents for you but they are not fit for learning either. The spec is the thing you start to use after you catch all the basics already, and where you check your understanding of them. But the HTML and CSS specs alone are not enough either. There's WCAG at least. And a fair bit of common sense.

I think the one tutorial you could start with is the one from Mozilla. It's not perfect either and you will need to read much more before you start writing good HTML.

Michał Górny
  • 18,713
  • 5
  • 53
  • 76
0

There's plenty of resources out there. Many great books and websites. Don't learn from the spec, it's very dry. You can't learn from the DTD - it's just a bunch of code outlining what elements can contain what, and so on. Here's a few things to check out:
http://jessey.net/simon/xhtml_tutorial/
http://diveintohtml5.info
http://www.kirupa.com/html5/introduction_html.htm https://developer.mozilla.org/en-US/docs/HTML/Introduction
And yes, I do(!) think that you can learn from w3schools. It's another good resource.

Abraham
  • 20,316
  • 7
  • 33
  • 39