SlideShare a Scribd company logo
INTRO TO CSS
IAT100 Spring 2008
INTRO TO CSS
 Covered in this lesson:
 Overview
 What is CSS?
 Why to use CSS?
 CSS for Skinning your Website
 Structure
 CSS Syntax Introduction
 Three places CSS can be defined
 CSS Syntax Specifics
 Cascading Inheritance
 Applied
 CSS Hands-on
WHAT IS CSS?
 Cascading Style Sheet
 Stylesheet Language
 Standards-based set of properties and attributes to define
styles
 To describe the presentation a document written in a
‘markup language’ like HTML or XML
 Markup encoding: <p>My paragraph here.</p>
 Defines the style of how things in <p> tags appear.
 Font, color, size, margins, etc.
 Cascading
 Rules to determine how to
 apply markup that contains
 other markup
WHY CSS?
 Separate Content from Form
 Content is the text and images, marked up to define regions of
specific types
 Form defines the “style” for the content
<font size=“14px”>
My First Header
</font>
<font size=“12px” color=“red” face=“Verdana”>
My information 1 goes here.
</font>
<font size=“14px”>
My Second Header
</font>
<font size=“12px” color=“red” face=“Verdana”>
Different information goes here.
</font>
The old way:
WHY CSS? CONTINUED.
 Separate Content from Form
 Content
 Form or Style
<p class=“header”>My First Header</p>
<p class=“info”>My Information 1 goes here</p>
<p class=“header”>My Second Header</p>
<p class=“info”>Different Information goes here</p>
(Specific markup properties like Class will be discussed later).
.header { font-size:14px;}
.info { font-family: verdana;
font-color: blue;
font-size: 12px; }
WHAT DOES THIS SEPARATION GET US?
 Separate Content from Form
 Specify the style once for every instance of that class.
 Example: Specify the font once for all text on the HTML page that
you’ve identified as a “header”.
 The stylesheet can be a separate file which all HTML pages
on your entire site can link to.
 Only have to specify the style once for your ENITRE SITE
 Can change the style for your entire site by editing only
ONE FILE.
CSS SKINNING
 “Skinning” - changing the look of a page or your site
 Selecting an appearance by choosing which stylesheet to use.
<link rel="stylesheet" type="text/css" href=“skin1.css" />
<p class=“info”>My Information 1 goes here</p>
skin1.css
.info { background-color: White;
font-family: Verdana;
font-color: Blue; }
Some information goes here.
+
=
CSS SKINNING 2
 “Skinning” - changing the look of a page or your site
 Selecting an appearance by choosing which stylesheet to use.
<link rel="stylesheet" type="text/css" href=“skin2.css" />
<p class=“info”>My Information 1 goes here</p>
skin1.css
.info { background-color: Blue;
font-family: Serif;
font-color: White; }
Some information goes here.
+
=
CSS SYNTAX
 3 Elements to a CSS Statement
 Selector
 What HTML sections does it affect?
 Property
 What attribute of that HTML section will be affected?
 Value
 What change will be made to that attribute?
THREE CSS DEFINITION LOCATIONS
 Inline: the “style” attribute
Note, the selector for inline CSS is the tag which contains the style attribute.
 Internal: the <style> markup tag
 External: the .css stylesheet file
<p style=“font-color:red;font-size:10px;”>Content</p>
<html><head><style>
p { background-color: Red;
font-family: serif;
font-color: White; }
</style></head><body>
<p>Content</p>
</body></html>
<link rel="stylesheet" type="text/css" href=“mystylesheet.css" />
CSS SYNTAX: SELECTORS
 There are many kinds of selectors and many ways to reference them:
 Type, Class, ID, Pseudo, etc.
 HTML Type Tag – selected with the tag type
 The Class Attribute – precede the class with a period
p { font-size: 10px;
font-color: White; }
<p>Content</p>
.myinfo { font-size: 10px;
font-color: White; }
<p class=“myinfo”>Content</p>
<div class=“myinfo”>Other content</div>
CASCADING INHERITANCE
 Nested elements inherit
the properties from the
its parent
 If you specify a style for the
<body> tag it will affect all
content in your HTML page.
 If you want to override
inherited settings, you
need to specify a style in
a more local element
body { font-family: Verdana;
font-size: 14px; }
body { font-family: Verdana;
font-size: 1.1em; }
.littletext { font-size: 8px; }
<body>
This text is larger.
<p class=“littletext”>This text is
smaller.</p>
CSS APPLIED
 Hands-on CSS Tutorial

More Related Content

Similar to CSS Cascading Style Sheet Introduction slides (20)

PPTX
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
PPTX
Session v(css)
Shrijan Tiwari
 
PDF
Chapter 3 - CSS.pdf
wubiederebe1
 
PPT
Css week11 2020 2021 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PDF
Css basics
Franc Santos
 
PDF
Css basics
Franc Santos
 
PPT
IP - Lecture 6, 7 Chapter-3 (3).ppt
kassahungebrie
 
PPTX
LIS3353 SP12 Week 13
Amanda Case
 
PPT
Css week11 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
Css class-01
Md Ali Hossain
 
PDF
Introduction to css
nikhilsh66131
 
PPTX
CSC PPT 4.pptx
DrRavneetSingh
 
PPT
Introduction to css by programmerblog.net
Programmer Blog
 
PPTX
Lecture 3CSS part 1.pptx
GmachImen
 
PPT
css-presentation.ppt
prathur68
 
PPT
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
PPTX
Unit iii css and javascript 1
Jesus Obenita Jr.
 
PPTX
Module 2 CSS . cascading style sheet and its uses
BKReddy3
 
PPT
CSS Training in Bangalore
rajkamal560066
 
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
Session v(css)
Shrijan Tiwari
 
Chapter 3 - CSS.pdf
wubiederebe1
 
Css week11 2020 2021 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Css basics
Franc Santos
 
Css basics
Franc Santos
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
kassahungebrie
 
LIS3353 SP12 Week 13
Amanda Case
 
Css week11 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Css class-01
Md Ali Hossain
 
Introduction to css
nikhilsh66131
 
CSC PPT 4.pptx
DrRavneetSingh
 
Introduction to css by programmerblog.net
Programmer Blog
 
Lecture 3CSS part 1.pptx
GmachImen
 
css-presentation.ppt
prathur68
 
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
Unit iii css and javascript 1
Jesus Obenita Jr.
 
Module 2 CSS . cascading style sheet and its uses
BKReddy3
 
CSS Training in Bangalore
rajkamal560066
 

Recently uploaded (20)

PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
grade 5 lesson ENGLISH 5_Q1_PPT_WEEK3.pptx
SireQuinn
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
grade 5 lesson ENGLISH 5_Q1_PPT_WEEK3.pptx
SireQuinn
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Ad

CSS Cascading Style Sheet Introduction slides

  • 1. INTRO TO CSS IAT100 Spring 2008
  • 2. INTRO TO CSS  Covered in this lesson:  Overview  What is CSS?  Why to use CSS?  CSS for Skinning your Website  Structure  CSS Syntax Introduction  Three places CSS can be defined  CSS Syntax Specifics  Cascading Inheritance  Applied  CSS Hands-on
  • 3. WHAT IS CSS?  Cascading Style Sheet  Stylesheet Language  Standards-based set of properties and attributes to define styles  To describe the presentation a document written in a ‘markup language’ like HTML or XML  Markup encoding: <p>My paragraph here.</p>  Defines the style of how things in <p> tags appear.  Font, color, size, margins, etc.  Cascading  Rules to determine how to  apply markup that contains  other markup
  • 4. WHY CSS?  Separate Content from Form  Content is the text and images, marked up to define regions of specific types  Form defines the “style” for the content <font size=“14px”> My First Header </font> <font size=“12px” color=“red” face=“Verdana”> My information 1 goes here. </font> <font size=“14px”> My Second Header </font> <font size=“12px” color=“red” face=“Verdana”> Different information goes here. </font> The old way:
  • 5. WHY CSS? CONTINUED.  Separate Content from Form  Content  Form or Style <p class=“header”>My First Header</p> <p class=“info”>My Information 1 goes here</p> <p class=“header”>My Second Header</p> <p class=“info”>Different Information goes here</p> (Specific markup properties like Class will be discussed later). .header { font-size:14px;} .info { font-family: verdana; font-color: blue; font-size: 12px; }
  • 6. WHAT DOES THIS SEPARATION GET US?  Separate Content from Form  Specify the style once for every instance of that class.  Example: Specify the font once for all text on the HTML page that you’ve identified as a “header”.  The stylesheet can be a separate file which all HTML pages on your entire site can link to.  Only have to specify the style once for your ENITRE SITE  Can change the style for your entire site by editing only ONE FILE.
  • 7. CSS SKINNING  “Skinning” - changing the look of a page or your site  Selecting an appearance by choosing which stylesheet to use. <link rel="stylesheet" type="text/css" href=“skin1.css" /> <p class=“info”>My Information 1 goes here</p> skin1.css .info { background-color: White; font-family: Verdana; font-color: Blue; } Some information goes here. + =
  • 8. CSS SKINNING 2  “Skinning” - changing the look of a page or your site  Selecting an appearance by choosing which stylesheet to use. <link rel="stylesheet" type="text/css" href=“skin2.css" /> <p class=“info”>My Information 1 goes here</p> skin1.css .info { background-color: Blue; font-family: Serif; font-color: White; } Some information goes here. + =
  • 9. CSS SYNTAX  3 Elements to a CSS Statement  Selector  What HTML sections does it affect?  Property  What attribute of that HTML section will be affected?  Value  What change will be made to that attribute?
  • 10. THREE CSS DEFINITION LOCATIONS  Inline: the “style” attribute Note, the selector for inline CSS is the tag which contains the style attribute.  Internal: the <style> markup tag  External: the .css stylesheet file <p style=“font-color:red;font-size:10px;”>Content</p> <html><head><style> p { background-color: Red; font-family: serif; font-color: White; } </style></head><body> <p>Content</p> </body></html> <link rel="stylesheet" type="text/css" href=“mystylesheet.css" />
  • 11. CSS SYNTAX: SELECTORS  There are many kinds of selectors and many ways to reference them:  Type, Class, ID, Pseudo, etc.  HTML Type Tag – selected with the tag type  The Class Attribute – precede the class with a period p { font-size: 10px; font-color: White; } <p>Content</p> .myinfo { font-size: 10px; font-color: White; } <p class=“myinfo”>Content</p> <div class=“myinfo”>Other content</div>
  • 12. CASCADING INHERITANCE  Nested elements inherit the properties from the its parent  If you specify a style for the <body> tag it will affect all content in your HTML page.  If you want to override inherited settings, you need to specify a style in a more local element body { font-family: Verdana; font-size: 14px; } body { font-family: Verdana; font-size: 1.1em; } .littletext { font-size: 8px; } <body> This text is larger. <p class=“littletext”>This text is smaller.</p>
  • 13. CSS APPLIED  Hands-on CSS Tutorial