Professional Documents
Culture Documents
CSC309 Tutorial --CSS & XHTML 3 Spring 2003 CSC309 Tutorial --CSS & XHTML 4 Spring 2003
Specify Style Rules Class Selectors
General form Define different styles for the same element
CSC309 Tutorial --CSS & XHTML 5 Spring 2003 CSC309 Tutorial --CSS & XHTML 6 Spring 2003
Background Text
<html> <html>
<head> <head>
<style type="text/css"> <style type="text/css">
body h1{
{ color: green;
background-image: url("microcrest.gif"); text-decoration: underline;
background-repeat: no-repeat; text-align: right;
background-position: center center; text-indent: 2cm
background-color: #ffffff }
} a{text-decoration: none;
h1{color: green} color: blue}
</style></head> h2{text-decoration: line-through}
<body> </style></head>
<h1> An example of <body>
backgound style</h1> This <a href="t.html>LINK</a> has no underline.
</body> <h1>This line: underlined</h1> <h2>Next line: line-through</h2>
</html> </body>
</html>
CSC309 Tutorial --CSS & XHTML 11 Spring 2003 CSC309 Tutorial --CSS & XHTML 12 Spring 2003
Font Lists
<html> u1.square {list-style-type: square}
<head>
<style type="text/css"> u1.circle{list-style-type: circle}
p.c1{ u1.disc{list-style-type: disc}
font-family: times;
font-size: 200%;
font-style: italic;
ol.decimal {list-style-type: decimal}
font-weight: bold ol.lroman {list-style-type: lroman}
} ol.uroman {list-style-type: uroman}
p.c2 { font-size: 150%}
</style></head>
ol.lalpha {list-style-type: lalpha}
<body> ol.ualpha {list-style-type: ualpha}
<p class="c1">This is line 1</h1>
<p class="c2">This is line 2</h2>
<p>This is line 3</p>
u{ list-style-image: url{("listimage.jpg")}
</body>
</html>
CSC309 Tutorial --CSS & XHTML 13 Spring 2003 CSC309 Tutorial --CSS & XHTML 14 Spring 2003
XHTML
XHTML is almost identical to HTML 4.01
XHTML is a stricter and cleaner version of HTML
XHTML is HTML defined as an XML application
CSC309 Tutorial --CSS & XHTML 19 Spring 2003 CSC309 Tutorial --CSS & XHTML 20 Spring 2003
A simple XHTML document Links
<?xml version="1.0" encoding="UTF-8"?> <a href="http://www.../course.html">absolute url</a>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN” <a href="course.html">relative url</a>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd"> <a href="course.html#end">link to the end of the paragraphy</a>
<html> define a name anchor: <a name="end" />
<head>
<title>simple document</title> <a href="mailto:tianhan@cs.toronto.edu"> email me</a>
</head>
<body> <a href="course.html"> <img src="flower.gif" alt="link to course page" />
<p>a simple paragraph</p> an image link</a>
</body>
</html> <a href="course.html" target="_blank">open a new window</a>
<a href="course.html" target="_top">link to the top window/a>
CSC309 Tutorial --CSS & XHTML 21 Spring 2003 CSC309 Tutorial --CSS & XHTML 22 Spring 2003
CSC309 Tutorial --CSS & XHTML 23 Spring 2003 CSC309 Tutorial --CSS & XHTML 24 Spring 2003
Tables Forms
<html><head> <html><body>
<style type="text/css"> <form name="input" action="formAction.asp" method="get">
td {text-align: center; Enter your first names:
vertical-align: top; <input type="text" name="FirstName" /><br />
padding: 15} Enter your last name:
</style></head> <input type="text" name="LastName" /><br />
<body> <input type="submit" value="Submit">
<table border="2" cellspacing="20"> </form>
<tr> <td colspan="2">AAA</td> </tr> <p>Click the "Submit" button to send your inputs</p>
<tr> </body>
<td rowspan="2">BBBBB</td> </html>
<td>CCC</td>
</tr>
<tr> <td>DDDDDDDD</td> </tr>
</table>
</body>
</html>
CSC309 Tutorial --CSS & XHTML 25 Spring 2003 CSC309 Tutorial --CSS & XHTML 26 Spring 2003