The <!DOCTYPE> declaration is the very first line of every web page. It is an "instruction" to the browser, telling it what version of HTML to expect so it can display the page correctly.
Browsers have two ways of reading a page:
In the past, declarations were long and difficult to remember. LearnHTML recommends always using the modern HTML5 version.
| Version | The Declaration |
|---|---|
| HTML5 | <!DOCTYPE> |
| HTML 4.01 | <!DOCTYPE HTML PUBLIC "-//LearnHTML/DTD HTML 4.01//EN"... |
| XHTML 1.1 | <!DOCTYPE html PUBLIC "-//LearnHTML/DTD XHTML 1.1//EN"... |
As HTML evolved at LearnHTML, many old tags were removed to make room for modern, powerful elements
| Tag | Function | HTML5 | HTML4 |
|---|---|---|---|
| <article> | Independent content | Supported | No |
| <video> | Plays movies | Supported | No |
| <audio> | Plays sound | Supported | No |
| <center> | Centers text | Obsolete | Yes |
| <font> | Changes text font | Obsolete | Yes |
| <footer> | Page bottom section | Supported | No |