html & xhtml - Seattle Central College

advertisement
HTML & XHTML
Introduction
First HTML
1992
 Marked-up text to represent a hypertext
document for transmission over the
network
 The hypertext mark-up language is an
SGML format
 The 1st web page was created

Versions of HTML - HTML 2.0
1996
 Can represent hypertext news, mail,
documentation, and hypermedia;
 Menus of options;
 Database query results;
 Simple structured documents with inlined graphics

HTML 3.2
Tables, applets, text-flow around images,
superscripts and subscripts
 Provided backwards compatibility with
the existing HTML 2.0 Standard.

HTML 4.0 & 4.01

Supports more
Multimedia options
 Scripting languages
 Style sheets
 Better printing facilities
 Accessible to users with disabilities
 Internationalization of documents
 Last of HTML

XML
eXtensible Markup Language
 Developed by the W3C
 A subset of SGML constituting a
particular text markup language for
interchange of structured data
 A flexible way to create standard
information structure
 Share data & structure over the Web

Example
XML file
 CSS file
 More at http://www.xml.com/

Sample XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="bellvideocss.css"?>
<!-- File Name: bellvideo.xml -->
<!DOCTYPE Video
[
<!ELEMENT Video (Movie+)>
<!ELEMENT Movie (Year, Title, Director, Type,
Actor_Male, Actor_Female, Time, Rating)>
<!ELEMENT Year (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Director (#PCDATA)>
<!ELEMENT Type (#PCDATA)>
<!ELEMENT Actor_Male (#PCDATA)>
<!ELEMENT Actor_Female (#PCDATA)>
<!ELEMENT Time (#PCDATA)>
<!ELEMENT Rating (#PCDATA)>
]
>
<Video>
<Movie>
<Year>1996</Year>
<Title>Mission: Impossible</Title>
<Director>Brian De Palma</Director>
<Type>Action</Type>
<Actor_Male>Tom Cruise</Actor_Male>
<Actor_Female>Emmanuelle Beart</Actor_Female>
<Time>110</Time>
<Rating>PG-13</Rating>
</Movie>
<Movie>
<Year>2004</Year>
<Title>Home on the Range</Title>
<Director>Will Finn</Director>
<Type>Comedy</Type>
<Actor_Male>G.W. Bailey</Actor_Male>
<Actor_Female>Roseanne</Actor_Female>
<Time>76</Time>
<Rating>PG</Rating>
</Movie>
</Video>
HTML + XML  XHTML
Extensible Hypertext Markup Language
 Application of XML
 Successor to HTML
 Reformulation of HTML 4.0 in XML 1.0
 Stricter remaking of HTML
 Deprecated tags – phasing out some
tags from HTML 4.01

Rules of XHTML
Use all lowercase letters for tags
 Nest elements correctly

<b><i>This is wrong.</b></i>
 <b><i>This is right.</i></b>.

Always use end tags
 End empty elements

<br>  <br /> <hr>  <hr />
 Error in page 57 in the textbook

Rules of XHTML (cont.)

Use quotation marks for values


Give every attribute a value


<h1 align=center>  <h1 align=“center“>
<hr noshade /> 
<hr noshade=“noshade” />
Use code for special characters

<img alt="Me & My Son"> 
<img alt="Me & My Son">.
Rules of XHTML (cont.)

Use id insead of name

< a name=“toc”>  <a id=“toc”>
Put styles and scripts in separate file
 Declare DOCTYPE

Resource: http://personalweb.about.com/od/basichtml/a/409xhtml.htm
Template
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en">
<head>
<title>TITLE OF PAGE GOES HERE</title>
</head>
<body>
CONTENT OF PAGE GOES HERE.
</body>
</html>
Download