Table of contentsBypass table of contents
The body is the container for the visual part of a document. All the things written here (except for special cases) will be shown when the document is finally rendered. Most of the tags in HTML can be inserted in the body section (inside the HTML body element) and will shape the visual aspects of the document.
For this tutorial, we're going to build a basic document structure that will be useful for the development of the following tutorial practices.
To begin with, we'll set the first thing every document should have in order to fit the standards: the Document Type Declaration (DTD). In this example, and because we think it's the best choice (the latest version that gives lesser troubles of browser compatibility), we'll build an XHTML compliant document. To do so, we first check the reference for the HTML !DOCTYPE tag, from where we'll get the right declaration.
The previous declaration will stablish what can or cannot be done in our document.
The next step in our practice is to define the html element inside of which the whole document will be enclosed. With this tag, we'll also set two parameters: the XML Name Space, through the "xmlns" attribute, and the language of the document through the "xml:lang" and the "lang" attributes (note that other standards not compatible with XML, like HTML 4.01, may use the "lang" attribute only and XHTML 1.1 will use the "xml:lang" attribute only). The value for the "xml:lang" and the "lang" attributes can be obtained from this list of language codes.
Now we'll add two important parts of any document: the head and the body. Both of these elements, the HTML head element and the HTML body element, will be inserted in that order, as content of the html element. Even when both elements have many attributes available, we wont use any of them as there's not need in this example (as in most basic documents). To save some steps we'll add both at the same time.
From here, we'll just place a title in the head; the content of the body will be left for further tutorials.
Remember that the title should describe in a short way the content of the document. We'll place the title using the HTML title element.
That's it. The main structure for a basic document has been set. This "frame" can be reused to build other documents, and will actually be used in the next tutorials. Get ready!
Diseño y desarrollo: Latitud29.com