Designing Web Pages The case for CSS
The Power of CSS css Zen Garden CSS In Action
Overview Description of CSS CSS Syntax CSS Formatting Options Grouping, Class Selectors, ID Selectors CSS Locations External Style Sheet, Internal Style Sheet, Inline Style Resources
What is CSS??? CSS stands for Cascading Style Sheets CSS added to HTML 4.0 to solve a problem HTML defines content of a document (,, etc.) CSS defines how to display the HTML content Styles are defined at four levels Browser defaults Within an external style sheet file (in a.css file) Within an internal style sheet (within ) Within an element (within, etc.)
CSS Syntax selector {property: value} body {color: white} p {font-family: "sans serif"} p {text-align:center;color:red} p { text-align: center; color: black; font-family: arial; }
CSS Grouping h1,h2,h3,h4,h5,h6 { color: green } p,tr,div { text-align: justify; border: 1 px; }
CSS Class Selectors p.right {text-align: right} This paragraph will be right-aligned..center {text-align: center} This heading will be center-aligned
CSS ID Selectors p#para1 { text-align: center; color: red } #green {color: green} This paragraph will be center-aligned and be on a red background.
External Style Sheet HTML File (.htm,.html) <link rel="stylesheet" type="text/css" href="mystyle.css" /> CSS File (.css) hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")}
Internal Style Sheet hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")}
Inline Styles This is a paragraph.
Resources CSS Home Page CSS Tutorial CSS Validator CSS Crib Sheet CSS Cheat Sheet