Skip to main content

XHTML Tutorial–Lesson 1 Part II

XHTML vs. HTML

Continuing with differentiating XHTML from HTML, in this lesson am going to mention some more rules for XHTML that differs it from HTML.

· Attribute values must be enclosed within double quotations.

· Attribute minimization is not allowed.

· Each XHTML page must have a DTD (Document Type Definition) that describes elements used in the page.

Below examples that illustrate the difference between XHTML and HTML for the above points:

In HTML, you might write something like this:

<font color=red>Anas</font>

In XHTML it is not valid, each attribute value must be enclosed within double quotations.

<font color=”red”>Anas</font>

For the second point, attribute minimization is not allowed in XHTML,

For example it is accepted in HTML to write

<option checked>

Or <frame noresize>

Or <input disabled>

All the above are not allowed in XHTML, you cannot abbreviate or minimize attributes,

To be written correctly in XHTML, it must be written like that:

<option checked=”checked” />

<frame noresize=”noresize” />

<input disabled=”disabled” />

Remember that empty tags like above ones that does not have a closing tag are closed by a space followed by a forward slash. />

Document Type Definition DTD:

All XHTML documents must have a DOCTYPE definition that describes the XHTML document, later on this tutorial we’ll talk in deep details about DOCTYPE, but for now am going to point to the structure of an XHTML document that must be used in each XHTML document, this structure must appear in all XHTML documents, and on the order. This structure consists of DOCTYPE declaration, followed by the html, head, title, and body elements. This structure mandatory, and differs from HTML that it must look like that and not optional, like what we saw in the beginning of this tutorial.

According to this rule, the minimum XHTML document looks like this:

<!DOCTYPE doctype definition goes here>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title></title>

</head>

<body>

</body>

</html>

Note that the DOCTYPE is not an XHTML element, so it does not follow XHTML rules for elements. The xmlns attribute of html specifies the xml namespace that is used in the document, it determines the rules of xml that must be followed in this document, this namespace is the default namespace of xml, so it is optional to write it or not, since it will be added automatically to the html tag.

To be continued,

To download this lesson as PDF click here: XHTML Tutorial–Lesson 1 Part II

Best Wishes,

Anas Jaghoub

Comments

Popular posts from this blog

PHP Tutorial–Guest Book–System Definition and Requirements

In this lesson I’m going to illustrate the system definition and requirements for the Guest Book application. It is an important step in developing any application, since this step gives us an orientation about the system and its functionality, what is expected from the system to do. actually the system definition comes from keywords from customers and end users, usually try to make it clear for what they need in the application, and what they expect the system to do.  As developers it is our role to define the requirements for the system to be developed. In our example the system definition for the Guest Book is: A system that allows visitors of the site to post their comments and feedbacks about the site, with the possibility for managing comments and maintain it easily and user friendly. On the other hand, the system requirements are: a web server, since it is clear that the developed system is going to run on the Internet, so it is a web-based application not windows-based.

تعلم تطوير تطبيقات للموبايل باستخدام الأندرويد

مرحبا أصدقائي يسعدني أن أبدأ معكم سلسلة حلقات في تعلم تطوير تطبيقات للموبايل باستخدام الأندرويد ، وسأسعى جاهدا معكم في أن تكون هذه السلسلة من أوائل السلسلات في اللغة العربية لتعليم برمجة تطبيقات الأندرويد من البداية وحتى الاحتراف. وسأحاول قدر المستطاع الشرح بلغة عربية بسيطة ومفهومة. حيث ستكون غدا إن شاء الله الحلقة الأولى من تعلم تطوير تطبيقات الموبايل باستخدام الأندرويد. أنس الجاغوب Twitter: @anasjaghoub Facebook: anasjaghoub

Web Development Best Practices (PHP Best Practices)

Websites development is one of the most challenging projects ever to develop, according to the large number of components you deal with, integrate, and manage in your application. For example, most web projects Deal with databases as their data source, and I ntegrate with external services called web services and APIs. As well the application M anages its own objects and components from views to models to controllers to plugins and so on. A skilled web developer should have a great/deep knowledge in most of components used in his system, and as well should ha ve intensive focus on how each component work and how can be used, what can be done, and what cannot. On the other hand, the huge amount of requirements, components to manage, and time frame given to you to accomplish your mission, and number of people in your team, all these factors together requires from you to organize your tasks, and priorities your requirements, do deep analysis and planning in order to have a hi