Beruflich Dokumente
Kultur Dokumente
Code rules
Attributes
Font SIZE/COLOR
Font Color
XHMTL
GOALS
Evolution
User Agents
Rules
Tags being written out
Empty Elements
DTD
XHTML Documument Type
Transitional DTD
Frameset DTD
Strict DTD
Presentational Material
Validating XHTML
XHTML Elements/attributes
Block-level elements
Inline elements
Standard Attributes
Defining the language
Title attribute
XHTML Namespace
page 19
XHTML
Goals
1) to separate the way documents are structured from the way
they are displayed
2) eliminate sloppy code- make it well-formed
User Agents
• web expansion to mobile phones, PDAs, software for visually
impaired
• devices of receiving and displaying data
• many items still not available: frames, tables, graphics
- these are in development
• other applications may collect and process data, but not display
• HTML is not suitable - allows sloppy code, transition to visual
page 20
Sloppy code...
(type exactly-and it will still work)
<h1>Chapter 4 - The Apes</h1><p>
"...Old Tantor; the elephant alone of all the wild savage life,
feared him not. When tantor trumpeted, the great ape scur-
ried with his fellows high among the trees of the second
terrace..."<p>
from<i> Tarzan of the Apes</i><br>
by<b> Edgar Rice Burrows
XHTML Rules
1) lower case tags
2) all tags must close
- eg) <p>.....</p>
3) must give proper instruction to browser (DTD)
4) must include base tags <html> <head><title>
5) tags imbedded based on importance <p><img>...</img></p>
page 21
Empty Elements
Do not contain content between the opening and closing tags
Transitional DTD
• allows you to continue using some discontinued items with
well-formed requirements of XHTML
<html>
<head><title>Great American Novel</title></head>
<body>
<p>It was a <s>dark and stormy night</s> <u>bright and sunny day</u>.
<s>Lightning streaked the sky, followed by an angry explosion of thunder.</s>
<u>High, soft clouds accented the sky and a soft wind gently swayed the
trees.</u></p>
</body></html>
Frameset DTD
- includes <frameset> and <frame> elements
- will eventually be written out in favor of STRICT DTD
Strict DTD
- includes <frameset> and <frame> elements
- will eventually be written out in favor of STRICT DTD
Document
no yes
No yes
(presentation material = text color, font faces, text size, borders, cell padding
- if any of these tags exist, it must be transitional.)
Validating XHTML
• browser may ignore errors and display
http://validator.w3.org
or for mac:http://validator.w3.org/file-upload.html
1) browse for file
2) iso-9959-1; western OR charset=utf-8
page 25
Code protocol/rules
• lower case (for XHTML)
• 5 spaces for first tab, 3 spaces for next (for tables)
• each tag on its own line
• carriage returns disregarded
• space bar makes only one space, no matter how many times you
hit it.
• tabs ignored
• multiple <p> tags ignored
• use comments to put notes in html
- <!-- comment goes here -->
Elements
• structure tags
• use < and >
• travel in pairs with a start and stop <h1> Hello World</h1>
Attributes
• descriptive terms that further describe or expand a tag
• only apply to the opening tag
• separated from the tag by a space
• ALWAYS followed by =" "
-<img src="name.gif">
• tags can have multiple attribute
-<table width="100%" cellpadding="0" cellspacing="0">
page 26
<head>
<title>A Simple XHTML Document</title>
</head>
<body>
<h1>A Simple XHTML Document</h1>
<p>This is a simple <strong>XHTML document</strong>. XHTML is a refor-
mulation of HTML 4.0 in XML. XML is the eXtensible Markup Language, and
was designed to both meet the formatting need of modern web-designers, while
attempting to retain the content emphasis of HTML/SGML's past.<br />Using
XHTML (and XML), a web-designer can customize the formatting of their docu-
ments to their heart's content, as well as create well-formed documents which con-
tain information easily accessible by external programs.</p>
<img src="image.jpg" />
</body>
</html>
XHTML Elements
ELEMENT DESCRIPTION
<address> Address
<blockquote> Block quotation (must contain <p> tags)
<del> Deleted text
<div> Generic block-level container
<dl> Definition list
<fieldset> Form control group
<form> Interactive form
<h1>- <h6> Heading elements
<hr /> Horizontal rule
<ins> Inserted text
<noscript> Alternate script content
<ol> Ordered list
<p> Paragraph
<pre> Preformatted text
<table> Table
<ul> Unordered list
Block-level elements
- appear on their own line
- can contain other block-level elements and inline elements
Inline elements
- text-level
- not on their own line, but within the block-level element
<strong> <br /> <emphasis>, etc
- not well formed if the block level is embedded in the inline
eg) <strong><p>hello</p></strong>
This is incorrect
page 28
</html>
Standard Attributes
- to configure elements
- always followed by ="..."
- some attributes can only be used with certain elements
eg) img src=""
ATTRIBUTE DESCRIPTION
class identifies various elements as part of the same group
dir specifies the direction of the text
id uniquely identifies an individual element in a document
lang / xml : lang specifies the language in which the contents of an element
were originally written
style defines style information for a specific element
title provides descriptive text for an element
page 29
Title Attribute
• provides descriptive text for an element
• text appears when the mouse hovers over the object
• also referred to as a ToolTip in Internet Explorer
• only works on newer browsers
XML Namespace
• organizes elements and attributes of an XML document into
separate groups
• attribute of html
• namespace for XHTML is XMLNS
• must be used for proper XHTML documents