WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Accespted XHTML - Lesson 2/5 Sun Jul 11, 2010 4:22 am

Unknown Data

Unknown Data
Registered Member
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.

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da">
<head>
<title>Document title</title>
</head>

<body>
<p>Document text</p>
</body>

</html>
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:
Code:
<?xml version="1.0"?>
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 æ,ø,å.
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
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.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
Transitional DTD: should be used if we need to use elements like <font>, it could be because of old browsers.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
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.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">
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".
Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="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.

http://woops.dk

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum