Thursday, March 28, 2024

So, You Want An HTML Declaration, Huh?

     If you’ve made your way through the HTML Goodies site, then you probably have looked at the source of some of my documents. I know some of you are looking because every now and again, I get a letter asking what that
strange, cryptic command right at the top stands for. If you don’t know what I mean, this is the command:


<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2//EN”>



     That’s a strange looking thing, huh? It’s called an “HTML Declaration.” Basically it’s declaring what version of HTML the browser is to use when reading this document. It also tells the viewer, if they care to look. It’s long, but rather easy to understand. Here’s what it means:


  • !DOCTYPE HTML PUBLIC proclaims this is an HTML document type that can be read by public browsers.


  • -//W3C represents the HTML organization that denotes what HTML commands are to be used and what are not. You can visit their WWW page at http://www.w3.org and read about HTML until your brain is full.


  • //DTD HTML 3.2 stands for Document Type Description HyperText MarkUp Language (version) 3.2.


  • //EN means the document will be written in the English language.


     If you were attempting to write HTML using the commands set aside in HTML 4.0, then you would change the header above from 3.2 to 4.0. Now, I’m not talking browsers here. I am talking version of HTML. Again, if you’d like to read about new and older versions of HTML and what makes them different, go to http://www.w3.org. 4.0 is out and there are reams of paper on what it will do.

     My assumption is that once you read this, you will right away ask if you need to hurry and put the command on your pages. I don’t have a good answer for you there. I knew that would come up so I contacted my brain trust of HTML people. One said yes, one said no, the other said to do it if you remember. Not exactly the consensus of answers I was looking for.

     So, do you use it? Yes. I do on every page now. I started putting it on when I first learned about it. Some of my very early pages do not have the command and I’m in no real hurry to get it on them. Mainly because
the pages use very early, and very basic, commands that do not belong to a higher version of HTML. Besides, if you do not have a declaration, I’ve been told the default is the highest HTML version. I would not be doing myself any good by altering the page.

     I’ll give you a couple rules of thumb that one of the HTML big-heads told me. If you’re using META commands or plan to use HTML validators… use the declaration.

     …and of course, any comments regarding the use of these commands will be cheerfully accepted. If you know something I don’t, tell me. I’ll post it if I feel others should know.

 

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured