HTML5 document types and head

Hungarian version!

I don’t want to write a long boring story from the tale of the definition of document types but the point is that is has been created because the browsers couldn’t follow the rapid changes in the standards. Basically that’s why the browsers showed the pages with full of errors or with incorrect subjects in the user’s browsers.

The definition of DTD has to be used before the <html> tag. The declaration is not an HTML tag but a definition which helps to the browser to understand what is the version wherein our HTML code was written. I didn’t count it but HTML4 and HTML4.01 has at least 7 definition. I’d like to show you 2 examples from these.

For example the declaration below allows all of the DTD HTML elements but not the frames.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The next example is the same like one mentioned above but the frames are allowed here.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

You can see from the above that the declarations are quite complicated and due to the standards numerous variations have been made from them. If you are interested in the HTML4 Doctype declarations i suggest visit the following webpage: http://www.w3.org/TR/html4/struct/global.html

What is new that HTML5 brings? 15 character.

<!DOCTYPE html>

That’s all folks. Nothing more nothing less. I think it can be noticed and harder to mess up.

The root element is <html>

Let’s see what happened with the root element. The next example shows how it looks in HTML4.01.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html lang="en" xml:lang="en">

It’s simplified and shortened in HTML5.

<!DOCTYPE html>
<html lang="en">

What’s in your head?

Mostly informations relative to character coding. Let’s see how it’s changed.

<meta http-equiv="content-type" content="text/html charset=UTF-8">

Like many things it’s also shortened.

<meta charset="UTF-8">

There may be hyperlinks. Links pointing to CSS files. Pointing to CSS. Such as:

<link rel="stylesheet" type="text/css" href="style.css" />

This is how it looks like:

<link rel="stylesheet" href="style.css" />

A tiny Internet Explorer trick.

Many HTML5 standard display cause trouble to the IE browsers. Thereunto gives a tricky solution the following script.
You can read further information about this here: http://code.google.com/p/html5shim/

<!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="utf-8" />
 <title>IE HACK!</title>
 <!--[if IE]>
 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
 </head>
 <body>
 </body>
 </html>

Source:

You may also like...