1. What is the difference between HTML and XHTML?

1. What is the difference between HTML and XHTML?
HTML is SGML-based
XHTML is XML-based.
HTML
HTML or HyperText
Markup Language is
the main markup
language for creating
Introduction
web pages and other
information that can
be displayed in a
web browser.
Filename .html, .htm
extension
XHTML
XHTML (Extensible HyperText
Markup Language) is a family of
XML markup languages that mirror
or extend versions of the widely
used Hypertext Markup Language
(HTML), the language in which
web pages are written.
.xhtml, .xht, .xml, .html, .htm
Internet text/html
media type
application/xhtml+xml
Developed W3C & WHATWG
by
World Wide Web Consortium
Type of Document file
format format
Extended SGML
from
Stands for
HyperText Markup
Language
Application of
Application Standard
Generalized Markup
Markup language
XML, HTML
Extensible HyperText Markup
Language
Application of XML
HTML
XHTML
Language (SGML).
Function
Web pages are
written in HTML.
Flexible framework
requiring lenient
Nature
HTML specific
parser.
Origin
Proposed by Tim
Berners-Lee in 1987.
HTML 2, HTML
Versions 3.2, HTML 4.0,
HTML 5.
Extended version of HTML that is
stricter and XML-based.
Restrictive subset of XML and
needs to be parsed with standard
XML parsers.
World Wide Web Consortium
Recommendation in 2000.
XHTML 1, XHTML 1.1, XHTML
2, XHTML 5.
2. Explain the basic syntax of HTML and XHTML.
1. <html>
<body>
<h1>______________</h1>
<p>_______________</p>
</body>
2. </html>
<html xmlns="http://www.td.org/1349/xhtml">
<head>
<title>...</title>
</head>
<body>...</body>
</html>
3. Explain the standard xhtml document structure.
XHTML Basic Document Structure
A basic XHTML document consists of the following main parts:





The DOCTYPE (DTD)
html document root
xmlns attribute for the html element
head element with a child title element
body element
Basic XHTML Document Structure:
<html xmlns="http://www.td.org/1349/xhtml">
<head>
<title>...</title>
</head>
<body>...</body>
</html>
4. Explain, how to do validation of XHTML documents?
The filename of the document to be validated is entered or found by
browsing. When the validate this file button is pressed, the specified
file is uploaded to the validator server, where the validation system
is run on it. The show source checkbox be checked because that
causes the validation system to furnish a listing if the document in
which the lines are numbered
5. Explain the syntactic difference between HTML and
XHTML.
The Most Important Differences:
 XHTML elements must be properly nested
 XHTML elements must always be closed
 XHTML elements must be in lowercase
 XHTML documents must have one root element
Some More XHTML Syntax Rules
 Attribute names must be in lower case
 Attribute values must be quoted
 Attribute minimization is forbidden
 The id attribute replaces the name attribute
 The XHTML DTD defines mandatory elements
Example of XHTML basic syntax
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0
Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>
HTML is about displaying information
XHTML is about describing the information
XHTML Was design to describe data and to focus what data is
HTML is design to display data and focus how datas look like.
HTML is a Hypertext Markup Language.
XHTML is an Extensible Hypertext Markup Language.
HTML is a static web page.
XHTML is an advanced version of it.we can make the web pages to
be displayed dynamically.XHTML is a combination of XML and
HTML.
XML is designed to describe data, and HTML is designed to display
data.
We get many advantages of using it.
6. Explain hypertext links in XHTML.
A Hypertext link in an XHTML document, which we simply call
a link here, acts as a pointer to some resource. That resource can
be an XHTML document anywhere on the web, or it may be just
another place in the document currently being displayed. It could
also be a specific place in some other document.
A link that points to different document specifies the
address of that document. Such an address might be a filename, a
directory path and a filename, or a complete URL. Links are
specified in an attribute of an anchor tag (<a>), which is an inline
tag. The anchor tag that specifies a link is called source of that
link. The document whose address is specified in a link is called
the target of that link.
7. Explain the tags for lists in XHTML
The tags to specify unordered, ordered, and the definition lists are
described below.
1. Unordered List: The <ul> tag which is a block tag,
creates an unordered list. Each item in a list is specified
with an <li> tag (li is an acronym for list item). Any tags
can appear in a list item, including nested lists.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
2. Ordered List: Ordered List are those in which the order
of items is important. Default sequential values are Arabic
numerals, beginning with 1. An ordered list is created
within the block tag <ol>. The items are specified and
displayed just like those for unordered list, Except that the
items in an ordered list are preceeded by sequential values
instead of bullets.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
8.Explain the table creation in XHTML
HTML Tables
Tables are defined with the <table> tag.A table is divided into rows
with the <tr> tag. (tr stands for table row).A row is divided into data
cells with the <td> tag. (td stands for table data).A row can also be
divided into headings with the <th> tag. (th stands for table
heading).The <td> elements are the data containers in the table.The
<td> elements can contain all sorts of HTML elements like text,
images, lists, other tables, etc.The width of a table can be defined
using CSS.
Example
<table style="width:300px">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
9. What is the use of forms in XHTML?
HTML Forms
HTML forms are used to pass data to a server.An HTML form can
contain input elements like text fields, checkboxes, radio-buttons,
submit buttons and more. A form can also contain select lists,
textarea, fieldset, legend, and label elements.The <form> tag is used
to create an HTML form.
<form>
Input elememts
</form>
The most important form element is the <input> element.The <input>
element is used to select user information.An <input> element can
vary in many ways, depending on the type attribute. An <input>
element can be of type text field, checkbox, password, radio button,
submit button, and more.
10.
Explain the basic text markup for the following:
1.Paragraph: Text is normally organized into paragraphs in the
body of a document. Textual paragraphs appear as a content of a
paragraph element, specified with the tag <p>.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
2.Line breaks: When a content of a paragraph element would
be displayed at a position other than at the beginning of a line,
the browser breaks the current line and inserts a blank line. This
is exactly what the break tag does. The break tag is specified as
<br />.
<p>this is an illustration <br />of break.
</p>.
3.preserving whitespace:It is desirable to preserve the
whitespace in text,that is to prevent the browser from
eliminating multiple spaces and ignoring embedded line
breaks.
<p><pre>
I
Have a
Black pen
</pre>
</p>
4.Headings: Text is often separated into sections in
documents by beginning each section with a heading.
XHTML provides 6 levels of headings specified by the
tags <h1><h2><h3><h4><h5><h6>.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
This is heading 1
This is heading 2
This is heading 3
5.Block quotations: If we want a block of text to be set
off from the normal flow of text in a document we use
<blockquote>.
<p> HTML is the universal markup language for the Web.
HTML lets you format text, add graphics, create links, input
forms, frames and tables, etc., and save it all in a text file that any
browser can read and display
</p>
<blockquote>.
<p> HTML is the universal markup language for the Web.
HTML lets you format text, add graphics, create links, input
forms, frames and tables, etc., and save it all in a text file that any
browser can read and display
</p>
6.Font style and sizes: HTML provides a collection of tags to set font
styles and sizes.<i> species ITALICS and <b>specifies BOLD <em>
specifies that its textual content is special and should be emphasised,
<strong> is like emphasis tag.
<p><b>This text is bold</b></p>
<p><strong>This text is strong</strong></p>
<p><i>This text is italic</i></p>
<p><em>This text is emphasized</em></p>
7.Horizontal rules: The parts of a document can be separated from
each other, making the document easier to read, by placing horizontal
lines between them. Such lines are called horizontal rules, and the tag
for this is <hr />.
<h1>HTML</h1>
<p>HTML is a language for describing web pages.....</p>
<hr>
<h1>CSS</h1>
<p>CSS defines how to display HTML elements.....</p>
8. Images: The inclusions of images in a document can be done
using <img /> tag which is an inline tag, specifies an image
that is to appear in a document.
<img src="smiley.gif" alt="Smiley face">