X hits on this document

532 views

0 shares

1 downloads

0 comments

60 / 142

XHTML

By liberally using these common attributes and assigning them meaningful values it is possible to com- pletely separate content from presentation and at the same time create accessible documents, documents that should be readable by all types of people as well as computers.

Stylistic elements are discouraged in an effort to further separate content from presentation. When styl- izing is necessary you are encouraged to make liberal use of CSS. Your CSS specification can reside in either an external file, embedded in the head of the XHTML document, or specified within each XHTML element using the style attribute.

Tables are a part of XHTML, and they are intended to be used to display tabular data. Using tables for layout is discouraged. Instead, by using the div and span element, in combination with CSS file, blocks of text within XHTML documents can be positioned on the screen.

Below is a simple XHTML file and CSS file representing a home page. Graphic design is handled by the CSS file, and even when the CSS file is not used the display is not really that bad.

<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>A simple home page</title> <link rel="stylesheet" href="home.css" type="text/css" /> </head> <body> <div class="menu"> <h3 class="label">Links</h3> <a href="http://infomotions.com/travel/" title="Travel logs">Travel logs</a> <br /> <a href="http://infomotions.com/musings/" title="Musings on Information">Musings on Information</a> <br /> <a href="http://infomotions.com/" title="Infomotions home page">About us</a> <br /> </div> <div class="content"> <h1>A simple home page</h1> <p> This is a simple home page illustrating the use of XHTMLversion 1.0.

</p> <p>

<img src="water.jpg" alt="Atlantic Ocean" width="120" height="160" align="right" hspace="5" vspace="3" />XHTML is not a whole lot different from HTML. It includes all of the usual tags such as the anchor tag for hypertext references (links) and images. Tables are still a part of the specification, but they are not necessarily intended for formatting purposes.

</p> <p>

The transition from HTML to XHTML is simple as long as you keep in mind a number of things. First, make sure you take into account the six rules for XML syntax. Second, shy away from using stylistic tags (elements) such as bold, italics, and especially font. Third, make liberal use of the div and span elements. When used in conjunction with CSS files, you will be able to easily position and format entire blocks of

52

Document info
Document views532
Page views538
Page last viewedThu Jan 19 00:38:10 UTC 2017
Pages142
Paragraphs3126
Words34660

Comments