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

AABU GTUG Opening Event

On February 17, 2011 We’ve headed to Al Al Bayt University, to run one of the biggest event established there, for opening the AABU GTUG (Google’s Technologies Users Group). The event focused on introducing the GTUGS (Google’s Technologies Users Groups) and introducing Google’s technologies to students, such as Android and App Engine, to Chrome Extensions and HTML5 demos. Attendees exceeded 250 attendee, in addition to Vice president of Al Al Bayt University Dr. Hashem Al Masaeed, Deanship of College of I.T at Al Al Bayt University Prof. Ismail Ababneh, and a quite number of professors and teachers at the college of I.T at AABU, in addition to Yarmuk fm and Al Ro’aya  tv. AABU GTUG as a Google’s Technologies Users Group interested in Google’s technologies and tries as possible to increase students awareness about Google’s technologies, and introduce it to them. Their was a lot of activities during the event, beginning with the key note from me Anas Jaghoub, that included introducin...

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

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

سلسلة تعلم برمجة تطبيقات الاندرويد – إنشاء أول تطبيق للاندرويد – الحلقة رقم 2

تحدثنا في الحلقة السابقة عن إعداد بيئة العمل، وأهم الأدوات والحزم اللازمة للبدء في تطوير تطبيقات لنظام التشغيل الاندرويد. سنتحدث في هذه الحلقة عن كيفية إنشاء تطبيق للاندرويد، وما هي مكونات تطبيق الاندرويد والبنية الهيكلية ﻷي تطبيق على الاندرويد. إنشاء تطبيق باستخدام بيئة العمل Netbeans : 1. اضغط على قائمة File 2. اختر New Project. 3. اختر نوع المشروع Android 4. اضغط زر Next. 5. اضبط إعدادات المشروع كالتالي: Project Name: اسم المشروع، يفضل أن يكون اسم المشروع هو نفس اسم التطبيق وذلك لتمييزه عن باقي المشاريع الأخرى Package Name: اسم حزمة المشروع، وهنا يجب اتباع قواعد تسمية الحزم في لغة Java إذ يجب أن تتكون من مقطعين على الأقل ويفصل بين كل مقطع بنقطة، ولا يوجد فراغات. Target Platform: رقم نسخة نظام التشغيل الاندرويد التي يدعمها هذا التطبيق، وهنا لا بد من اختيار أقل رقم يتوافق معه هذا التطبيق لمزيد من التفاصيل شاهد الصورة التالية: 6. اضغط على زر Finish وهكذا نكون قد أنشأنا بمساعدة بيئة العمل Netbeans أول تطبيق للأندرويد حيث تم تصميم هيكل التطبيق، واستدعاء كافة ال...