1
XHTML - Lesson 2/5 on Sun Jul 11, 2010 2:52 am
Unknown Data
Registered Member

XHTML - Lesson 2/5 Learn XHTML - Part 2 |
This is lesson 2 out of 5. The structure in a XHTML document The structure in a XHTML document reminds a lot of the structure in a HTML document. But there are differences, that can give you big problems if you don't follow the rules. Actually we can say that the formal requirements are just higher in this new language. A normal document could fx be coded like this.
That's right, it looks a lot identical to the HTML, but we will discover some new attributes and elements later in this tutorial. Labeling and indication of our coding In part 1 out of five we learned that XHTML is written in the language XML. That's why the first line of a XHTML document got the labeling of witch XML version we use. In this case we are using XML version 1.0 and then we write:
The next thing we should label is witch encoding we should use. The encoding is a kind of a alphabet, and that why people there write with other letters than UTF8 and UTF16, has to change the encoding. The encoding I've put in the top is for danish/norwegian people, there use letters like æ,ø,å.
Document type definition (DTD) In the next line we should indicate witch DTD we use. DTD is a kind of a rule set. In XTHML there exist 3 DTD's to chose between: Transitional, Strict and Frameset. Strict DTD: should be used if you wish to code in the recommended standard.
Transitional DTD: should be used if we need to use elements like <font>, it could be because of old browsers.
Frameset DTD: should be used if you only will use the frameset, that means not the document, that appear in the frameset, but the frameset itself.
Namespace identification and chose of language In a XHTML document should the <html> element contain the attribute xmlns, there only got the value "http://www.w3.org/1999/xhtml". I'll not explain all about this, because there only are one thing to write, and you would got very confusing if you just heard about it. So lets leave it. The element <htmL> contains also the attribute xml:lang, that informs us about witch language we are using. The language is indicated by the ISO639 standard, were we can find all languages in the world. I'm from Denmark and that's why I'm writing "da".
The rest piece of a XHTML document is like the old HTML document with <head> and <body>, but the structure, elements and attributes got some other rules, we will learn in the next tutorials. |
| Notice : This tutorial is copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators. |


Home

