martes, 20 de noviembre de 2012

The doctype


The doctype

1. The syntax in HTML 4 and XHTML 1.0

The first line of every HTML document corresponding to the document type declaration, the doctype. This DTD (Document Type Declaration) serves to indicate what version of HTML is used in the document.

This would be a DTD HTML 4.01 Transitional document:

<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN" "http://www.w3.org/TR/html4/loose.dtd">
And this would be a DTD XHTML 1.0 Strict document:

<! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This statement indicates the name of the DTD and facilitates the URL in the browsers that can access the original source of the statement. Its syntax is not always understood by everyone, grasp it requires time and effort. Also, let's face it, all of us, and I am the first, we have always limited to copy and paste this line one project to another.

2. The syntax in HTML5

The DTD declaration in HTML5 not be simpler:

<! DOCTYPE html>
The most surprising addition to the brevity of this syntax is the absence of the version number. Now, we might ask: "How will the browser which version of HTML we used in our paper?".

We must not forget that one of the goals of HTML5 is to support previous versions and also to future versions of the language. Precisely for that reason, specify a version number is obsolete, including it would have absolutely no use.

No hay comentarios:

Publicar un comentario