SlideShare a Scribd company logo
The Basics of Cascading Style Sheets (CSS) Irina McGuire Graphic Designer | Front-End Web Developer www.irinamcguire.com December 3, 2010
Introduction What do you know about CSS?  What do you hope to do with CSS? How familiar are you with HTML? Examples of beautiful CSS Web sites: www.csszengarden.com One content, many layouts .
Presentation Summary What is CSS? CSS & HTML The Box Model Style Sheet Implementation CSS Rule Structure HTML & DIVs Common CSS properties CSS Cascade and Inheritance Resources
What is CSS? CSS stands for  Cascading Style Sheet .  Typical CSS file is a text file with an extention .css  and contains a series of commands or rules.  These rules tell the HTML how to display. *To create a style sheet, create a file using Notepad (PC) or Text Edit (Mac), save it as a .css document and start writing the CSS code (see right). /* Styles for sitename.com*/  body { font-family:Arial;  background: #000; } #container { text-align:left; width:1020px; } #header { height:232px; } #footer { width: 100%; padding: 0 10px; margin-bottom: 10px; } And so on…. Style.css
CSS Benefits Separates structure from presentation Provides advanced control of presentation Easy maintenance of multiple pages Faster page loading Better accessibility for disabled users Easy to learn
HTML Without CSS “ HTML without CSS is like a piece of candy without a pretty wrapper.” Without CSS, HTML elements typically flow from top to bottom of the page and position themselves to the left by default. With CSS help, we can create containers or DIVs to better organize content  and make a Web page visually appealing.
HTML & CSS HTML and CSS work together to produce beautiful and functional Web sites HTML = structure CSS =  style
The Box Model CSS works on the box model. A typical Web page consists of many boxes joined together from top to bottom. These boxes can be stacked, nested, and can float. Header Navigation Content Footer
Attaching a Style Sheet Attach a style sheet to a page by adding the code to the <head> section of the HTML page. There are  3 ways  to attach CSS to a page:  1. External Style Sheet:  Best used to control styling on multiple pages. <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot;  media=&quot;all&quot; href=&quot;css/styles.css&quot; /> 2. Internal Style Sheet:  Best used to control  styling on one page. <style type=“text/css”> h1 {color: red) </style> 3. Inline Style Sheet*:  CSS is not attached in the <header> but is used directly within HTML tags. <p  style=“color: red” >Some Text</p>
CSS Rule Structure A CSS RULE is made up of a selector and a declaration. A declaration consists of property and value. selector  { property: value; } declaration
Selectors body   { property :  value ;  }  h1  { property :  value ;  }  em  { property :  value ;  }  p  { property :  value ;  }  A selector, here in  green , is often an element of HTML.
Properties and Values body { background: purple; }  h1 { color: green;  } h2 { font-size: large; } p { color: #ff0000;}  /*hexadecimal for red*/ body { background: purple; color: green; } Properties and values tell an HTML element how to display. *CSS code can be written in a linear format (above) or in a block format (below).
Grouping Selectors  h1  {color: black;} h1  {font-weight: bold;} h1  {background: white;} h1  { color: black;  font-weight: bold;  background: white; } Group  the same selector  with different declarations together on one line. Example of grouping selectors (both are correct):
Grouping Selectors Group  different selectors  with the same declaration on one line. h1 { color: yellow; } h2 { color: yellow; } h3 { color: yellow; } h1, h2, h3 { color: yellow; } Example of grouping selectors (both are correct):
Comments in CSS Explain the purpose of the coding Help others read and understand the code Serve as a reminder to you for what it all means Starts with /*and  ends with*/  p { color: #ff0000;}  /*Company Branding*/
Typical Web Page (Browser) header footer main menu Container
Typical Web Page (HTML) <div id=“ container ”> <div id=“ header ”>Insert Title</div> <div id=“ main &quot;>content <div id=“ menu ”>content</div> </div> <div id=“ footer ”>content</div> </div> Typical HTML Web page is made up of containers (boxes) or DIVs. Each DIV is assigned an ID or a Class.
Typical Web Page (CSS) # container  {property: value;}  # menu  {property: value;}  # main  {property: value;}  # footer  {property: value;}  The CSS file uses the same DIV/ID/Class names as the HTML and uses them to style the elements.
IDs and Classes IDs (#)  are unique and can only be used once on the page Classes (.)  can be used as many times as needed HTML  Code: <h1 id=“ mainHeading ”>Names</h1> <p class=“ name ”>Joe</p> CSS Code: # mainHeading  {color: green} . name  {color: red}
CSS Box Properties Background-color Width Padding Margin Border-width Border-color Border-style
HTML    CSS div id=“header” div id=“footer” div id=“content” # content  { background-color: #ccc; margin-bottom: 10px; border: 1px dashed blue; color: #fff; width: auto; }
Common CSS Layout Properties Width Height Float Clear Border Padding Margin width height padding margin border
Width & Height div id=“box” #box {width=“50px”} #box {width=“50em”}  #box {width=“100%”} #box {width=“auto”}  Width and height define the width and height of an element. #box {height=“auto”}  *Width and height can be specified in pixels, ems, percentages or set to auto
Float: (left, right) Float property makes elements float to the right or left of the screen, positioned where they are in the HTML.  Floating allows word wrapping.  div id=“box” Here is some text which wraps around the box floated to the left. #box {float:left; margin-right: 10px;}
Clear: (left, right, both) #box3 { background-color: white; border:   1px solid #000; clear: both;}  When elements are floated, they wrap around each other to form a “caravan.” The  clear  property detaches an element from the “caravan” and allows it to start on a new line. div id=“box1” div id=“box2” div id=“box3”
Border (top, right, bottom, left) #box {  border-color: red;  border-style: dotted;  border-width: 2px; div id=“box” #box {  border: red dotted 1px; #box { border-top: red dotted 1px; border-bottom: red dotted 1px; border-left: red dotted 1px; border-right: red dotted 1px; } You can define the entire border or only the top, bottom, left, or right. You can also define the border using one declaration. The code could be any of the following:
Padding (top, right, bottom, left) Padding is the space between the text/content and the border. You can use padding for all around the element or specify each side of the rectangle separately. The code could be any of the following: padding: 10px; Padding: 10px 10px; padding: 10px 10px 10px 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 10px; padding-top: 10px; div id=“box” padding
Margin (top, right, bottom, left) Margin is the space outside the text/content and the border. You can use margin for all around the element or specify each side of the rectangle separately. The code could be any of the following: margin: 10px; or margin: 10px 10px; or margin: 10px 10px 10px 10px; or margin-left: 10px; margin-right: 10px; margin-bottom: 10px; margin-top: 10px; margin div id=“box”
Text Properties .mainHeading { color: red; letter-spacing: 5px; text-transform: uppercase; word-spacing: 15px; text-align: left; font-family: Times; text-decoration: underline; font-size: 12px; font-style: italic; font-weight: bold; } MAIN HEADING Gravida lacinia velit. Vivamus tortor enim, tincidunt at, pellentesque ut, iaculis eu, quam.  To style the main heading in the paragraph above, we assigned a class the HTML tag. <h3 class=“mainHeading”>Main Heading</h3>
CSS Colors White Black Blue Fuchsia Gray Green Lime Aqua #ffffff #fff  #cccf0f3 Standard Hexadecimal
Styling Links a:link {color: red; text-decoration: none;border-bottom: 1px dashed red; background: white;}  a:visited {color: yellow;} a:active {color: green;} a:hover {color: orange;} The links property defines how inactive, hovered, active, and visited  link  states appear to the user.
Including Images Properties for working with images include: Background-image Background-repeat Background-position Background-attachment
Layering Background colors and images are layered like sheets of paper one on top of the other.  #bg { background:url(leaves.jpg) no-repeat  top  left} #main {background-color: red} #box {background-color: yellow} div id=“bg” div id=“main” div id=“box”
Background-Image li { background-image:url(flower.jpg); padding-left: 10px; } Background images and colors are layered.  If not transparent, the last one listed in the CSS file is visible. The background-image property sets an image in the background of an element.
Background-Repeat li { background-image:url(flower.jpg);  background-repeat:no-repeat; } Possible Values  >  The background-repeat property sets an image in the background of an element and tiles, or repeats, it. Tiling is the default. repeat repeat-x (horizontal) repeat-y (vertical) no-repeat
Image Positioning The background-position property positions the image using either combined keywords (top, bottom, left, right, and center); length values; or percentage values. The background-attachment property fixes or scrolls an image in the browser window. Values include  fixed  and  scroll . background-position: right top; /*can also use number values*/ background-attachment: fixed; /*can also use ‘scroll’*/  left  top center top left  bottom center bottom right bottom
The Power of Cascade When multiple styles or style sheets are used, they start to cascade and sometimes compete with one another due to CSS’s inheritance feature. Any tag on the page could potentially be affected by any of the tags surrounded by it. So, which one wins? Nearest Ancestor Wins. Inline style or directly applied style  The last style sheet declared in the <header> section
Saving Time with Inheritance In a nutshell,  inheritance  (not the money you get from your grandma) is the process by which CSS properties applied to one tag are passed on to nested tags. For example, the paragraph tag will inherit the same styling as the body tag because <p> is always located inside <body>. <body style=“font-family: Arial”> <p>This text will be Arial as well</p> </body> So, instead of styling each paragraph separately, you can define the font color in the <body>, and everything inside will have that color.
Resources http://www.w3schools.com/css/css_reference.asp  (list of all CSS properties) http://www.w3schools.com/css/ http://www.glish.com/css/ http://www.html.net/tutorials/css/ http://blog.html.it/layoutgala/ Great Book “ CSS: The Missing Manual” -  by David Sawyer McFarland CSS Galleries http://www.cssbeauty.com/gallery/ www.cssdrive.com http://www.css-website.com
Thank You I hope you enjoyed this presentation and learned some basic CSS. Good luck with creating beautiful and functional Web sites.

More Related Content

What's hot (20)

PDF
jQuery for beginners
Arulmurugan Rajaraman
 
PPTX
Html5 tutorial for beginners
Singsys Pte Ltd
 
PDF
Introduction to html
eShikshak
 
PPTX
HTML/HTML5
People Strategists
 
PPTX
Html coding
Briana VanBuskirk
 
PPT
CSS ppt
Sanmuga Nathan
 
PPTX
Html ppt
santosh lamba
 
PDF
Introduction to HTML5
Gil Fink
 
PDF
Html frames
eShikshak
 
PPT
Span and Div tags in HTML
Biswadip Goswami
 
PPTX
HTML5 & CSS3
Ian Lintner
 
PDF
Html / CSS Presentation
Shawn Calvert
 
PPTX
html-table
Dhirendra Chauhan
 
PPTX
Introduction to CSS
Folasade Adedeji
 
PPTX
Cascading style sheet
Michael Jhon
 
PPT
Html Ppt
vijayanit
 
PPTX
Basic html structure
Jhaun Paul Enriquez
 
PPTX
HTML Forms
Ravinder Kamboj
 
PPTX
Html forms
Himanshu Pathak
 
PPTX
Basic HTML
Sayan De
 
jQuery for beginners
Arulmurugan Rajaraman
 
Html5 tutorial for beginners
Singsys Pte Ltd
 
Introduction to html
eShikshak
 
HTML/HTML5
People Strategists
 
Html coding
Briana VanBuskirk
 
Html ppt
santosh lamba
 
Introduction to HTML5
Gil Fink
 
Html frames
eShikshak
 
Span and Div tags in HTML
Biswadip Goswami
 
HTML5 & CSS3
Ian Lintner
 
Html / CSS Presentation
Shawn Calvert
 
html-table
Dhirendra Chauhan
 
Introduction to CSS
Folasade Adedeji
 
Cascading style sheet
Michael Jhon
 
Html Ppt
vijayanit
 
Basic html structure
Jhaun Paul Enriquez
 
HTML Forms
Ravinder Kamboj
 
Html forms
Himanshu Pathak
 
Basic HTML
Sayan De
 

Similar to CSS Basics (20)

PPT
Css
NIRMAL FELIX
 
DOCX
Css Introduction
SathyaseelanK1
 
PPTX
Css ppt
Nidhi mishra
 
PPTX
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
 
PPTX
Web - CSS 1.pptx
haroon451422
 
PPT
CSS
ARJUN
 
PPTX
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
DOC
Art of css
Raphael Wanjiku
 
PPT
Basic css
Gopinath Ambothi
 
PPTX
CSS Cascade Style Sheet
Adeel Rasheed
 
ODP
Css.prabu
Prabu Cse
 
PPT
CSS - Basics
Shubham_Saurabh
 
PPTX
Web topic 15 1 basic css layout
CK Yang
 
PPTX
CSS.pptx
PushpaLatha551681
 
Css Introduction
SathyaseelanK1
 
Css ppt
Nidhi mishra
 
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
 
Web - CSS 1.pptx
haroon451422
 
CSS
ARJUN
 
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
Art of css
Raphael Wanjiku
 
Basic css
Gopinath Ambothi
 
CSS Cascade Style Sheet
Adeel Rasheed
 
Css.prabu
Prabu Cse
 
CSS - Basics
Shubham_Saurabh
 
Web topic 15 1 basic css layout
CK Yang
 
Ad

Recently uploaded (20)

PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
July Patch Tuesday
Ivanti
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Designing Production-Ready AI Agents
Kunal Rai
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Ad

CSS Basics

  • 1. The Basics of Cascading Style Sheets (CSS) Irina McGuire Graphic Designer | Front-End Web Developer www.irinamcguire.com December 3, 2010
  • 2. Introduction What do you know about CSS? What do you hope to do with CSS? How familiar are you with HTML? Examples of beautiful CSS Web sites: www.csszengarden.com One content, many layouts .
  • 3. Presentation Summary What is CSS? CSS & HTML The Box Model Style Sheet Implementation CSS Rule Structure HTML & DIVs Common CSS properties CSS Cascade and Inheritance Resources
  • 4. What is CSS? CSS stands for Cascading Style Sheet . Typical CSS file is a text file with an extention .css and contains a series of commands or rules. These rules tell the HTML how to display. *To create a style sheet, create a file using Notepad (PC) or Text Edit (Mac), save it as a .css document and start writing the CSS code (see right). /* Styles for sitename.com*/ body { font-family:Arial; background: #000; } #container { text-align:left; width:1020px; } #header { height:232px; } #footer { width: 100%; padding: 0 10px; margin-bottom: 10px; } And so on…. Style.css
  • 5. CSS Benefits Separates structure from presentation Provides advanced control of presentation Easy maintenance of multiple pages Faster page loading Better accessibility for disabled users Easy to learn
  • 6. HTML Without CSS “ HTML without CSS is like a piece of candy without a pretty wrapper.” Without CSS, HTML elements typically flow from top to bottom of the page and position themselves to the left by default. With CSS help, we can create containers or DIVs to better organize content and make a Web page visually appealing.
  • 7. HTML & CSS HTML and CSS work together to produce beautiful and functional Web sites HTML = structure CSS = style
  • 8. The Box Model CSS works on the box model. A typical Web page consists of many boxes joined together from top to bottom. These boxes can be stacked, nested, and can float. Header Navigation Content Footer
  • 9. Attaching a Style Sheet Attach a style sheet to a page by adding the code to the <head> section of the HTML page. There are 3 ways to attach CSS to a page: 1. External Style Sheet: Best used to control styling on multiple pages. <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;all&quot; href=&quot;css/styles.css&quot; /> 2. Internal Style Sheet: Best used to control styling on one page. <style type=“text/css”> h1 {color: red) </style> 3. Inline Style Sheet*: CSS is not attached in the <header> but is used directly within HTML tags. <p style=“color: red” >Some Text</p>
  • 10. CSS Rule Structure A CSS RULE is made up of a selector and a declaration. A declaration consists of property and value. selector { property: value; } declaration
  • 11. Selectors body { property : value ; } h1 { property : value ; } em { property : value ; } p { property : value ; } A selector, here in green , is often an element of HTML.
  • 12. Properties and Values body { background: purple; } h1 { color: green; } h2 { font-size: large; } p { color: #ff0000;} /*hexadecimal for red*/ body { background: purple; color: green; } Properties and values tell an HTML element how to display. *CSS code can be written in a linear format (above) or in a block format (below).
  • 13. Grouping Selectors h1 {color: black;} h1 {font-weight: bold;} h1 {background: white;} h1 { color: black; font-weight: bold; background: white; } Group the same selector with different declarations together on one line. Example of grouping selectors (both are correct):
  • 14. Grouping Selectors Group different selectors with the same declaration on one line. h1 { color: yellow; } h2 { color: yellow; } h3 { color: yellow; } h1, h2, h3 { color: yellow; } Example of grouping selectors (both are correct):
  • 15. Comments in CSS Explain the purpose of the coding Help others read and understand the code Serve as a reminder to you for what it all means Starts with /*and ends with*/ p { color: #ff0000;} /*Company Branding*/
  • 16. Typical Web Page (Browser) header footer main menu Container
  • 17. Typical Web Page (HTML) <div id=“ container ”> <div id=“ header ”>Insert Title</div> <div id=“ main &quot;>content <div id=“ menu ”>content</div> </div> <div id=“ footer ”>content</div> </div> Typical HTML Web page is made up of containers (boxes) or DIVs. Each DIV is assigned an ID or a Class.
  • 18. Typical Web Page (CSS) # container {property: value;} # menu {property: value;} # main {property: value;} # footer {property: value;} The CSS file uses the same DIV/ID/Class names as the HTML and uses them to style the elements.
  • 19. IDs and Classes IDs (#) are unique and can only be used once on the page Classes (.) can be used as many times as needed HTML Code: <h1 id=“ mainHeading ”>Names</h1> <p class=“ name ”>Joe</p> CSS Code: # mainHeading {color: green} . name {color: red}
  • 20. CSS Box Properties Background-color Width Padding Margin Border-width Border-color Border-style
  • 21. HTML CSS div id=“header” div id=“footer” div id=“content” # content { background-color: #ccc; margin-bottom: 10px; border: 1px dashed blue; color: #fff; width: auto; }
  • 22. Common CSS Layout Properties Width Height Float Clear Border Padding Margin width height padding margin border
  • 23. Width & Height div id=“box” #box {width=“50px”} #box {width=“50em”} #box {width=“100%”} #box {width=“auto”} Width and height define the width and height of an element. #box {height=“auto”} *Width and height can be specified in pixels, ems, percentages or set to auto
  • 24. Float: (left, right) Float property makes elements float to the right or left of the screen, positioned where they are in the HTML. Floating allows word wrapping. div id=“box” Here is some text which wraps around the box floated to the left. #box {float:left; margin-right: 10px;}
  • 25. Clear: (left, right, both) #box3 { background-color: white; border: 1px solid #000; clear: both;} When elements are floated, they wrap around each other to form a “caravan.” The clear property detaches an element from the “caravan” and allows it to start on a new line. div id=“box1” div id=“box2” div id=“box3”
  • 26. Border (top, right, bottom, left) #box { border-color: red; border-style: dotted; border-width: 2px; div id=“box” #box { border: red dotted 1px; #box { border-top: red dotted 1px; border-bottom: red dotted 1px; border-left: red dotted 1px; border-right: red dotted 1px; } You can define the entire border or only the top, bottom, left, or right. You can also define the border using one declaration. The code could be any of the following:
  • 27. Padding (top, right, bottom, left) Padding is the space between the text/content and the border. You can use padding for all around the element or specify each side of the rectangle separately. The code could be any of the following: padding: 10px; Padding: 10px 10px; padding: 10px 10px 10px 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 10px; padding-top: 10px; div id=“box” padding
  • 28. Margin (top, right, bottom, left) Margin is the space outside the text/content and the border. You can use margin for all around the element or specify each side of the rectangle separately. The code could be any of the following: margin: 10px; or margin: 10px 10px; or margin: 10px 10px 10px 10px; or margin-left: 10px; margin-right: 10px; margin-bottom: 10px; margin-top: 10px; margin div id=“box”
  • 29. Text Properties .mainHeading { color: red; letter-spacing: 5px; text-transform: uppercase; word-spacing: 15px; text-align: left; font-family: Times; text-decoration: underline; font-size: 12px; font-style: italic; font-weight: bold; } MAIN HEADING Gravida lacinia velit. Vivamus tortor enim, tincidunt at, pellentesque ut, iaculis eu, quam. To style the main heading in the paragraph above, we assigned a class the HTML tag. <h3 class=“mainHeading”>Main Heading</h3>
  • 30. CSS Colors White Black Blue Fuchsia Gray Green Lime Aqua #ffffff #fff #cccf0f3 Standard Hexadecimal
  • 31. Styling Links a:link {color: red; text-decoration: none;border-bottom: 1px dashed red; background: white;} a:visited {color: yellow;} a:active {color: green;} a:hover {color: orange;} The links property defines how inactive, hovered, active, and visited link states appear to the user.
  • 32. Including Images Properties for working with images include: Background-image Background-repeat Background-position Background-attachment
  • 33. Layering Background colors and images are layered like sheets of paper one on top of the other. #bg { background:url(leaves.jpg) no-repeat top left} #main {background-color: red} #box {background-color: yellow} div id=“bg” div id=“main” div id=“box”
  • 34. Background-Image li { background-image:url(flower.jpg); padding-left: 10px; } Background images and colors are layered. If not transparent, the last one listed in the CSS file is visible. The background-image property sets an image in the background of an element.
  • 35. Background-Repeat li { background-image:url(flower.jpg); background-repeat:no-repeat; } Possible Values > The background-repeat property sets an image in the background of an element and tiles, or repeats, it. Tiling is the default. repeat repeat-x (horizontal) repeat-y (vertical) no-repeat
  • 36. Image Positioning The background-position property positions the image using either combined keywords (top, bottom, left, right, and center); length values; or percentage values. The background-attachment property fixes or scrolls an image in the browser window. Values include fixed and scroll . background-position: right top; /*can also use number values*/ background-attachment: fixed; /*can also use ‘scroll’*/ left top center top left bottom center bottom right bottom
  • 37. The Power of Cascade When multiple styles or style sheets are used, they start to cascade and sometimes compete with one another due to CSS’s inheritance feature. Any tag on the page could potentially be affected by any of the tags surrounded by it. So, which one wins? Nearest Ancestor Wins. Inline style or directly applied style The last style sheet declared in the <header> section
  • 38. Saving Time with Inheritance In a nutshell, inheritance (not the money you get from your grandma) is the process by which CSS properties applied to one tag are passed on to nested tags. For example, the paragraph tag will inherit the same styling as the body tag because <p> is always located inside <body>. <body style=“font-family: Arial”> <p>This text will be Arial as well</p> </body> So, instead of styling each paragraph separately, you can define the font color in the <body>, and everything inside will have that color.
  • 39. Resources http://www.w3schools.com/css/css_reference.asp (list of all CSS properties) http://www.w3schools.com/css/ http://www.glish.com/css/ http://www.html.net/tutorials/css/ http://blog.html.it/layoutgala/ Great Book “ CSS: The Missing Manual” - by David Sawyer McFarland CSS Galleries http://www.cssbeauty.com/gallery/ www.cssdrive.com http://www.css-website.com
  • 40. Thank You I hope you enjoyed this presentation and learned some basic CSS. Good luck with creating beautiful and functional Web sites.

Editor's Notes

  • #2: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #3: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #4: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #5: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #6: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #7: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #8: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #9: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #10: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #11: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #12: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #13: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #14: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #15: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #16: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #17: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #18: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #19: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #20: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #21: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #22: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #23: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #24: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #25: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #26: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #27: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #28: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #29: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #30: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #31: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #32: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #33: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #34: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #35: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #36: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #37: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #38: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #39: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #40: Cascading Style Sheets: Pixel-Level Control with HTML Ease
  • #41: Cascading Style Sheets: Pixel-Level Control with HTML Ease