Professional Documents
Culture Documents
CSSJHL
CSSJHL
SHEETS (CSS)
FASHIONING TEXT STYLES AND COLORS
CASCADING STYLE SHEETS
✓ Using CSS would help you present your webpage
that is pleasing to the eye.
• It defines how to display HTML elements.
If HTML handles the contents of the webpage, then CSS is in
charge of the presentation.
HTML is about the meaning, while CSS is about formatting
– in other words defining the characteristics of the design
elements used in your HTML documents.
BIG PROBLEM
HTML was never intended to contain tags for formatting a
document.
BASIC HTML
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
BIG PROBLEM
When tags like <font>, and color attributes were
added to the HTML 3.2 specification, it started a
nightmare for web developers.
Development of large web sites, where fonts and
color information were added to every single page,
became a long and expensive process.
SOLUTION
➢ To solve this problem, the World Wide Web
Consortium (W3C) created CSS.
In HTML 4.0, all formatting could be removed from
the HTML document, and stored in a separate CSS
file.
All browsers support CSS today.
CSS SYNTAX
A CSS rule has two main parts: a selector, and one or more
declarations:
CSS SYNTAX
For example:
p { color: rgb(0,255,0);}
STYLE SHEET SYNTAX
◦ BY THE RGB-HEX CODE – Hex means hexadecimal. It is
composed by 16 digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F
(with 0 being the lowest and F being the highest).
For example:
p { color: #f00; }
STYLE SHEET SYNTAX
5. text-align: Values available are: left, right, center and
justify.
6. text-decoration: Values available are: overline (line above
texts, strike-through (line through texts), underline , none
(removes line from links)
7. text-transform: Values available are: capitalize (capitalize
the first letter of every word), uppercase (to capitalize all the
letters), lowercase (to set capitals to lowercase for all the
letters), and none.
STYLE SHEET SYNTAX
8. letter-spacing: This refers to the space between letters,
whose values are: normal or __ em.
9. word-spacing: This refers to the space between words,
whose values are: normal or ___ em.
10. line-height: This refers to the space between lines,
whose values are: normal, __%, or ___em. This adjusts the
height of the line of lines of the text (for example, in a
paragraph).
P{
word-spacing: normal;
Color: black;
Font-size: 80%;
}
H2 {
Letter-spacing: 1em;
Text-align: center;
Color: rgb (0, 255, 0);
Font-family: Verdana, “Monotype Corsiva”, Tahoma;
Font-size: 85px;
Font-style: italic;
}