Lecture 11 - Formatting With Styles - 2
Lecture 11 - Formatting With Styles - 2
Styles (2)
Outline
In the last Lecture, we continued our discussion of CSS
By considering Formatting with Styles:
Setting Font properties:
font-family, font-style, font-weight, font-size, and line-height.
We also began discussing Setting Text properties:
Introduction: CSS colors
1. Setting text color
In this Lecture,
We continue our discussion of Text properties…
In the context of a detailed, step-by-step example:
Our simple chess-openings page.
Controlling Text Characteristics
As we mentioned, with CSS you may control a variety of text
characteristics…
Via specific text properties:
1. Text Color (color)
2. Text Background Color (background)
3. Spacing (letter-spacing and word-spacing)
4. Adding Indents (text-indent)
5. White-space (white-space)
6. Text alignment (text-align)
7. Text case (text-transform)
8. Font variants, such as small caps (font-variant)
9. Text decorations, such as strike-throughs, etc (text-decoration)
Note: The absolute values computed for this property are inherited.
Text 4: Adding Indents
You may set the amount of space to precede a paragraph’s 1st line:
Using the text-indent property:
body{background-color:#99ccff}
h1,h2{font: 20px “Arial Black”,“Helvetica Bold”, sans-serif;
color:navy; letter-spacing: 0.4 em}
h2{font-size: 14px} .emph{font-style:italic}
p{font:12px/150% “Verdana”, “Helvetica”, sans-serif; color:#cc00ff;
text-indent: 1.0em}
a:link{font-weight:bold; color:#cc00ff} a:visited{font-weight:normal}
a:hover{font-weight:bold; color:#0000ff}
#toc{font-size: 12px; color:#cc00ff; background-color:#cccccc }
The text-indent property takes the usual length values (px, em, etc):
A positive value specifies a normal (to the right) indent;
A negative value specifies creates a hanging indent.
Above, we specify an indent of 1.0em = 1.0 x 12px = 12px of space.
Use a value of normal (or 0) to specify the default spacing.
Note: The absolute values computed for this property are inherited.
Text 5: Setting White-Space Properties
You may allow typed white-space in an element to be displayed:
By setting the white-space property:
body{background-color:#99ccff}
h1,h2{font: 20px “Arial Black”,“Helvetica Bold”, sans-serif;
color:navy; letter-spacing: 0.4 em}
h2{font-size: 14px} .emph{font-style:italic}
p{ font:12px/150% “Verdana”, “Helvetica”, sans-serif; color:#cc00ff;
text-indent: 1.0em} a:link{font-weight:bold; color:#cc00ff}
a:visited{font-weight:normal} a:hover{font-weight:bold; color:#0000ff}
#toc{font-size: 12px; color:#cc00ff; background-color:#cccccc;
white-space: nowrap}
[3] Layout with CSS: Create a new page for your directory, in which you:
(a) Define multiple divisions, and set the page layout with CSS…
By moving the elements out of the normal flow.
(b) Demonstrate at least 2 of: Absolute, Fixed, and Relative Positioning.
[4] Include a 1-2 page Word file, explaining your CSS format/layout:
Describing how each above requirement (1a-c; 2a-b; 3a-b) is fulfilled.