Chapter3 Copy-14nov22
Chapter3 Copy-14nov22
Chapter3 Copy-14nov22
CHAPTER 3
KEY CONCEPTS
Style Sheets
◦ used for years in Desktop Publishing
◦ apply typographical styles
and spacing to printed media
CSS
◦ provides the functionality of style sheets (and much more) for web
developers
◦ a flexible, cross-platform, standards-based language developed by
the W3C.
Inline Styles
Embedded Styles
External Styles
Imported Styles
External Styles
◦ Separate text file with .css file extension
◦ Associate with a HTML link element in the head section of a web page
◦ Imported Styles
◦ Similar to External Styles
◦ We’ll concentrate on the other three types of styles.
<h1 style="color:#FF0000;background-color:#cccccc">This is
displayed as a red heading with gray background</h1>
<style>
body { background-color: #E6E6FA;
color: #191970;
font-family: Arial, Verdana, sans-serif; }
h1 { background-color: #191970;
color: #E6E6FA;
line-height: 200%;
font-family: Georgia, "Times New Roman", serif; }
h2 { background-color: #AEAED4;
color: #191970; text-align: center;
font-family: Georgia, "Times New Roman", serif; }
p {font-size: .90em; text-indent: 3em; }
ul {font-weight: bold; }
</style>
Purpose:
◦ configure a specially formatted area displayed in-
line with other elements, such as within a
paragraph.
HTML:
<p>Your needs are important to us at <span
class=“companyname">Acme Web Design</span>.
We will work with you to build your Web site.</p>
Etc…
A self-contained tag
Placed in the head section
Purpose: associates the external style
sheet file with the web page.
Example:
<link rel="stylesheet" href="color.css">
You applied CSS style rues to HTML, class, id, and descendent
selectors.
You are able to submit your CSS to the W3C CSS Validation test.