Escolar Documentos
Profissional Documentos
Cultura Documentos
html
head
title
body
XHTML 02
Today
Tables
<table>
Tables in XHTML
Style sheets
XHTML 02
XHTML 02
Tags
<table> </table>
border attribute
<tr> </tr>
<td> </td>
<html>
<head>
<title>TABLES</title>
</head>
<body>
<p>What follows is a simple table</p>
<table border=1px>
<tr>
<td>One row</td><td>Two Columns</td>
</tr>
</table>
Row
<tr>
<td> </td>
<td> </td>
</tr>
Data
XHTML 02
</body>
</html>
XHTML 02
Table Exercise
Styles
Exercise 1: Write a fragment of XHTML code that will generate a table with
2 rows and 1 column. The text in the first row should be first row and
the text in the second row should be second row. The table should
have a 1 pixel border.
http://csszengarden.com
XHTML 02
Defining a style
XHTML 02
10
Grouping rules
h1 { font-weight:
bold }
h2 { font-weight:
bold }
bold }
Value
h1 { color: green; }
Selector
XHTML 02
11
XHTML 02
12
Grouping rules
Class selectors
h1 { color: green }
h1 { text-align: center }
h1 {
color: green;
text-align: center;
}
Class selector
.className { property: value; }
XHTML 02
13
XHTML 02
14
Id selectors
.quote
{
text-align: center;
font-style: italic;
XHTML 02
15
XHTML 02
16
Example id selector
CSS Exercise
Exercise 2: What is a selector in a CSS style?
XHTML 02
17
XHTML 02
18
Saved in a file
called theme.css
h1 { color: green; }
<head>
<title> </title>
<link rel=stylesheet href=theme.css type=text/css></link>
</head>
XHTML 02
19
XHTML 02
20
Inline styles
<style type=text/css>
Used in the head of the document to contain styles
type attribute specifies media type of the <style> tag
<head>
<title>Example</title>
<style type=text/css>
.quote { text-align: center; }
h1 { color: green; }
</style>
</head>
XHTML 02
21
22
CSS Exercises
Exercise 3: Write a simple XHTML page with the title Simple CSS
example. The body of the page should contain a single paragraph
with the text Hello. The text should have the color property
set to green. An internal style sheet should be used to define an
appropriate style that can be applied to the paragraph.
XHTML 02
Increasing priority
http://en.wikipedia.org/wiki/Cascading_Style_Sheets
http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)
XHTML 02
23
XHTML 02
24
CSS Exercises
CSS Exercises
Exercise 4: Put the following into decreasing order of priority. The
item at the bottom of the list should have the lowest priority.
<html>
<head>
<title>Simple CSS Example</title>
<style type=text/css>
p {color: green;}
</style>
</head>
<body>
<h1>test</h1>
<p>Hello World</p>
</body>
</html>
XHTML 02
Internal style sheet, Browser default, Inline styles, External style sheet
25
XHTML 02
26
No CSS
<div>
Block-level tag
May contain other block-level tags
Invisible in XHTML, but can have styles applied
<span>
Inline tag
May contain other inline tags
Invisible in XHTML, but can have styles applied
XHTML 02
27
XHTML 02
28
CSS Example
body {
font-family: sans-serif;
}
h1,h2 {
text-align: center;
background-color: black;
color: white;
}
#footer{
border-top-width: thick;
border-top-style: solid;
font-size: small;
}
.emphasize{
font-weight: bold;
}
29
XHTML 02
31
XHTML 02
30