SlideShare a Scribd company logo
Getting Started with CSS
Objectives
Assess style rules
Create an embedded style sheet
Implement an ID selector
Implement a class selector
Use multiple selectors
HTML 5 and CSS 3 – Illustrated Complete 2
Objectives (continued)
Create an external style sheet
Link to an external style sheet
Add a comment to a style sheet
Debug and validate CSS code
HTML 5 and CSS 3 – Illustrated Complete 3
Assess Style Rules
CSS (Cascading Style Sheets): adds
style information to elements defined
in HTML code
Style rules: lines or blocks of CSS
code that specify the presentation of
web page elements
Declarations: basic building block of
CSS, includes a property name and a
value, e.g. text-align: center
HTML 5 and CSS 3 – Illustrated Complete 4
Assess Style Rules
(continued)
Style rules contain two main parts
 Selectors: identify the HTML elements to
which the rule applies
 Declarations: specify CSS property to
apply to the selector and value to assign
to the property
• Each declaration (property: value) ends with
a semicolon
• All declarations surrounded by curly braces
HTML 5 and CSS 3 – Illustrated Complete 5
Assess Style Rules
(continued)
CSS style rule
CSS properties and values
HTML 5 and CSS 3 – Illustrated Complete 6
Create an Embedded
Style Sheet
Embedded Style Sheet: CSS code
inserted in the head element of an
HTML document
 Most straightforward method for affecting
the presentation of a single web page
 Generally used only with a single web
page
 Labor intensive to update embedded
styles if added to lots of web pages
HTML 5 and CSS 3 – Illustrated Complete 7
Create an Embedded
Style Sheet (continued)
Embedded style rule and resulting
web page
HTML 5 and CSS 3 – Illustrated Complete 8
Implement an ID Selector
id selector: affects the presentation of
a specific HTML element
Add id attribute to opening tag of an
HTML element to give it a unique
value
• e.g., <p id=“name”> John Smith </p>
Use # and id value to create CSS id
selector for a style rule
• e.g., #name {text-align: right;}
HTML 5 and CSS 3 – Illustrated Complete 9
Implement an ID Selector
(continued)
Style rule using id selector
HTML 5 and CSS 3 – Illustrated Complete 10
Implement an ID Selector
(continued)
Presentation resulting from use of ID
selector
HTML 5 and CSS 3 – Illustrated Complete 11
Implement a Class Selector
class attribute: can be assigned to
multiple HTML elements
class selector: creates a style rule
based on values assigned to the class
attribute
 Allows style rule to be applied to
unlimited number of separate elements
 Consists of period followed by class
attribute value; e.g. .accent
HTML 5 and CSS 3 – Illustrated Complete 12
Implement a class Selector
(continued)
class attribute and style rule with
class selector added
HTML 5 and CSS 3 – Illustrated Complete 13
Implement a class Selector
(continued)
Presentation resulting from use of
class selector
HTML 5 and CSS 3 – Illustrated Complete 14
Use Multiple Selectors
Multiple selectors allow you to add the
same style rule to multiple HTML
elements
 Type selector name, comma, space
(optional), next selector name
 Type a curly brace, followed by the
declaration(s), followed by a curly brace
HTML 5 and CSS 3 – Illustrated Complete 15
Use Multiple Selectors
(continued)
Commonly used CSS selectors
HTML 5 and CSS 3 – Illustrated Complete 16
Create an External
Style Sheet
External style sheet: separate file
containing style information
 Suitable for maintaining a consistent
style in large websites
 Prevents need to implement style
changes on each page of website
 Changes made to external style sheet
are reflected in all web pages linked to
that style sheet
 Can be linked to multiple HTML pages
HTML 5 and CSS 3 – Illustrated Complete 17
Create an External
Style Sheet (continued)
An external style sheet
HTML 5 and CSS 3 – Illustrated Complete 18
Link to an External
Style Sheet
Use the HTML link element to link
an HTML document to an external
style sheet, e.g.
 <link rel=“stylesheet”
href=“mystylesheet.css” />
Attributes of the link element
HTML 5 and CSS 3 – Illustrated Complete 19
Link to an External
Style Sheet (continued)
Web page linked to an external style
sheet and the style sheet
HTML 5 and CSS 3 – Illustrated Complete 20
Link to an External
Style Sheet (continued)
Multiple pages styled by external style
sheet
HTML 5 and CSS 3 – Illustrated Complete 21
Add a Comment to a
Style Sheet
Use comments in CSS style sheet to
document the file
Syntax for style sheet comments
 /* for opening tag
 [comment text]
 */ for closing tag
Format for style sheet comments
 Can be single line
 Can be multi-line
HTML 5 and CSS 3 – Illustrated Complete 22
Add a Comment to a
Style Sheet (continued)
Style sheet with comment added
HTML 5 and CSS 3 – Illustrated Complete 23
Debug and Validate
CSS Code
Important to debug and validate CSS
code against CSS rules even when
CSS code works in browser testing
 Helps ensure compatibility of code with
different user agents
 Helps ensure that code remains usable
You can use online tools to validate
your code
HTML 5 and CSS 3 – Illustrated Complete 24
Debug and Validate
CSS Code (continued)
Use developer tools to debug code,
such as developer tools in Chrome
HTML 5 and CSS 3 – Illustrated Complete 25
Debug and Validate
CSS Code (continued)
Use online service to validate CSS
code, such as W3C validation service
page
HTML 5 and CSS 3 – Illustrated Complete 26
Summary
HTML and CSS are complementary
languages
 HTML specifies the page content
 CSS indicates how the content should be
displayed
CSS uses style rules
 Selector, which identifies the HTML
element
 Declaration, which includes a property
name and a value
HTML 5 and CSS 3 – Illustrated Complete 27
Summary (continued)
Different types of selectors affect
different groups of elements
 Type selector: applies to all HTML
elements of a specific type, such as h1
 id selector: applies to a single element
having a specific unique id
 class selector: applies to elements with
a value specific to the class attribute
 Multiple selectors: applies the same
rule(s) to different elements
HTML 5 and CSS 3 – Illustrated Complete 28
Summary (continued)
Embedded style sheets are included
in the HTML code
 Suitable for single page websites
External style sheets can be linked to
multiple web pages
 All linked web pages can be changed by
changing a single style sheet
Use the link element to link a web
page to a CSS style sheet
HTML 5 and CSS 3 – Illustrated Complete 29
Summary (continued)
Use comments to document the style
sheet
 /* [comment text] */
Use developer tools to debug CSS
code
Use online validation service to
validate CSS code against CSS rules
HTML 5 and CSS 3 – Illustrated Complete 30

More Related Content

What's hot

Javascript programming using the document object model
Javascript programming using the document object modelJavascript programming using the document object model
Javascript programming using the document object model
Nicole Ryan
 
Creating and Processing Web Forms
Creating and Processing Web FormsCreating and Processing Web Forms
Creating and Processing Web Forms
Nicole Ryan
 
Creating Visual Effects and Animation
Creating Visual Effects and AnimationCreating Visual Effects and Animation
Creating Visual Effects and Animation
Nicole Ryan
 
Laying Out Elements with CSS
Laying Out Elements with CSSLaying Out Elements with CSS
Laying Out Elements with CSS
Nicole Ryan
 
Working with Video and Audio
Working with Video and AudioWorking with Video and Audio
Working with Video and Audio
Nicole Ryan
 
Lesson 2 cs5
Lesson 2   cs5Lesson 2   cs5
Lesson 2 cs5dtelepos
 
Lesson 3 cs5
Lesson 3   cs5Lesson 3   cs5
Lesson 3 cs5dtelepos
 
How to make Html
How to make HtmlHow to make Html
How to make Html
Meghal Murkute
 
Content Architecture
Content ArchitectureContent Architecture
Content Architecture
Dara Pressley
 
Crystal report
Crystal reportCrystal report
Crystal report
Everywhere
 
Microsoft FrontPage PPT
Microsoft FrontPage PPTMicrosoft FrontPage PPT
Microsoft FrontPage PPT
anushreekmurthy
 
Introduction, features and environment of ms front page 2003
Introduction, features and environment of ms front page 2003Introduction, features and environment of ms front page 2003
Introduction, features and environment of ms front page 2003Ann Alcid
 
Chapter 02
Chapter 02Chapter 02
Chapter 02
Gene Babon
 
Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Slideshare
 
Introduction To Flex
Introduction To FlexIntroduction To Flex
Introduction To Flex
Yoss Cohen
 
Html 5 Tags - Beginners
Html 5  Tags - BeginnersHtml 5  Tags - Beginners
Html 5 Tags - Beginners
SathyaseelanK1
 
SugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-InSugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-In
JeevanTechnologies
 
C# Crystal Reports
C# Crystal ReportsC# Crystal Reports
C# Crystal Reports
Muhammad Umer Riaz
 

What's hot (20)

Javascript programming using the document object model
Javascript programming using the document object modelJavascript programming using the document object model
Javascript programming using the document object model
 
Creating and Processing Web Forms
Creating and Processing Web FormsCreating and Processing Web Forms
Creating and Processing Web Forms
 
Creating Visual Effects and Animation
Creating Visual Effects and AnimationCreating Visual Effects and Animation
Creating Visual Effects and Animation
 
Laying Out Elements with CSS
Laying Out Elements with CSSLaying Out Elements with CSS
Laying Out Elements with CSS
 
Working with Video and Audio
Working with Video and AudioWorking with Video and Audio
Working with Video and Audio
 
Lesson 2 cs5
Lesson 2   cs5Lesson 2   cs5
Lesson 2 cs5
 
Lesson 3 cs5
Lesson 3   cs5Lesson 3   cs5
Lesson 3 cs5
 
M02 un12 p01
M02 un12 p01M02 un12 p01
M02 un12 p01
 
How to make Html
How to make HtmlHow to make Html
How to make Html
 
Content Architecture
Content ArchitectureContent Architecture
Content Architecture
 
Crystal report
Crystal reportCrystal report
Crystal report
 
Microsoft FrontPage PPT
Microsoft FrontPage PPTMicrosoft FrontPage PPT
Microsoft FrontPage PPT
 
Introduction, features and environment of ms front page 2003
Introduction, features and environment of ms front page 2003Introduction, features and environment of ms front page 2003
Introduction, features and environment of ms front page 2003
 
Crystal report
Crystal reportCrystal report
Crystal report
 
Chapter 02
Chapter 02Chapter 02
Chapter 02
 
Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010Crystal report generation in visual studio 2010
Crystal report generation in visual studio 2010
 
Introduction To Flex
Introduction To FlexIntroduction To Flex
Introduction To Flex
 
Html 5 Tags - Beginners
Html 5  Tags - BeginnersHtml 5  Tags - Beginners
Html 5 Tags - Beginners
 
SugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-InSugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-In
 
C# Crystal Reports
C# Crystal ReportsC# Crystal Reports
C# Crystal Reports
 

Viewers also liked

Organizing Content with Lists and Tables
Organizing Content with Lists and TablesOrganizing Content with Lists and Tables
Organizing Content with Lists and Tables
Nicole Ryan
 
Microsoft TechDays - CSS3 Presentation
Microsoft TechDays - CSS3 PresentationMicrosoft TechDays - CSS3 Presentation
Microsoft TechDays - CSS3 Presentation
Rachel Andrew
 
Tutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 SiteTutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 Site
Adam Stewart
 
CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong?
Russ Weakley
 
Ajax - Presente e futuro delle applicazioni web
Ajax - Presente e futuro delle applicazioni webAjax - Presente e futuro delle applicazioni web
Ajax - Presente e futuro delle applicazioni web
Dominopoint - Italian Lotus User Group
 
Everything You know about CSS is Wrong
Everything You know about CSS is WrongEverything You know about CSS is Wrong
Everything You know about CSS is Wrong
chandleryu
 
Corso base di Tecnologie WEB - una visione d'insieme
Corso base di Tecnologie WEB - una visione d'insiemeCorso base di Tecnologie WEB - una visione d'insieme
Corso base di Tecnologie WEB - una visione d'insieme
Studiabo
 
Presentación Multimedia - HTML5
Presentación Multimedia - HTML5Presentación Multimedia - HTML5
Presentación Multimedia - HTML5
Viviana Trujillo
 
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียสตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
Samit Koyom
 
Techdays 2012 - Développement Web Mobile avec Microsoft
Techdays 2012 - Développement Web Mobile avec MicrosoftTechdays 2012 - Développement Web Mobile avec Microsoft
Techdays 2012 - Développement Web Mobile avec Microsoftwyggio
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
Stephen Hay
 
Css floats
Css floatsCss floats
Css floats
Webtech Learning
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
Russ Weakley
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
Michael Jhon
 
CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)
Lea Verou
 
CSS Layouting #4 : Float
CSS Layouting #4 : FloatCSS Layouting #4 : Float
CSS Layouting #4 : Float
Sandhika Galih
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
Lea Verou
 
Conoce HTML5 y CSS3
Conoce HTML5 y CSS3Conoce HTML5 y CSS3
Conoce HTML5 y CSS3
Marta Armada
 
Xml dtd
Xml dtdXml dtd
Xml dtd
sana mateen
 

Viewers also liked (20)

Organizing Content with Lists and Tables
Organizing Content with Lists and TablesOrganizing Content with Lists and Tables
Organizing Content with Lists and Tables
 
Microsoft TechDays - CSS3 Presentation
Microsoft TechDays - CSS3 PresentationMicrosoft TechDays - CSS3 Presentation
Microsoft TechDays - CSS3 Presentation
 
Tutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 SiteTutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 Site
 
CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong?
 
Ajax - Presente e futuro delle applicazioni web
Ajax - Presente e futuro delle applicazioni webAjax - Presente e futuro delle applicazioni web
Ajax - Presente e futuro delle applicazioni web
 
Everything You know about CSS is Wrong
Everything You know about CSS is WrongEverything You know about CSS is Wrong
Everything You know about CSS is Wrong
 
Corso base di Tecnologie WEB - una visione d'insieme
Corso base di Tecnologie WEB - una visione d'insiemeCorso base di Tecnologie WEB - una visione d'insieme
Corso base di Tecnologie WEB - una visione d'insieme
 
Presentación Multimedia - HTML5
Presentación Multimedia - HTML5Presentación Multimedia - HTML5
Presentación Multimedia - HTML5
 
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียสตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
ตัวอย่าง Workshop basic html5 and css3 จากไอทีจีเนียส
 
Techdays 2012 - Développement Web Mobile avec Microsoft
Techdays 2012 - Développement Web Mobile avec MicrosoftTechdays 2012 - Développement Web Mobile avec Microsoft
Techdays 2012 - Développement Web Mobile avec Microsoft
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
 
Css floats
Css floatsCss floats
Css floats
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)
 
CSS Layouting #4 : Float
CSS Layouting #4 : FloatCSS Layouting #4 : Float
CSS Layouting #4 : Float
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
 
Conoce HTML5 y CSS3
Conoce HTML5 y CSS3Conoce HTML5 y CSS3
Conoce HTML5 y CSS3
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 

Similar to Getting Started with CSS

Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
GmachImen
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheetsJafar Nesargi
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheetsJafar Nesargi
 
Css introduction
Css introductionCss introduction
Css introductionSridhar P
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
SSN College of Engineering, Kalavakkam
 
Css
CssCss
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
casestudyhelp
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Erin M. Kidwell
 
Building Next Generation Websites Session5
Building Next Generation Websites Session5Building Next Generation Websites Session5
Building Next Generation Websites Session5
Muhammad Ehtisham Siddiqui
 
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
Lec 1
Lec 1Lec 1
Web Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptxWeb Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptx
clement swarnappa
 
chitra
chitrachitra
chitra
sweet chitra
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
Rafi Haidari
 
Using Cascading Style Sheets2
Using Cascading Style Sheets2Using Cascading Style Sheets2
Using Cascading Style Sheets2Sutinder Mann
 
Css.html
Css.htmlCss.html

Similar to Getting Started with CSS (20)

Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Css introduction
Css introductionCss introduction
Css introduction
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Css
CssCss
Css
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
 
Css
CssCss
Css
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Building Next Generation Websites Session5
Building Next Generation Websites Session5Building Next Generation Websites Session5
Building Next Generation Websites Session5
 
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham SiddiquiBuilding Next Generation Websites by Muhammad Ehtisham Siddiqui
Building Next Generation Websites by Muhammad Ehtisham Siddiqui
 
Lec 1
Lec 1Lec 1
Lec 1
 
Web Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptxWeb Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptx
 
chitra
chitrachitra
chitra
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
 
Using Cascading Style Sheets2
Using Cascading Style Sheets2Using Cascading Style Sheets2
Using Cascading Style Sheets2
 
Css.html
Css.htmlCss.html
Css.html
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 

More from Nicole Ryan

Inheritance
InheritanceInheritance
Inheritance
Nicole Ryan
 
Python Dictionaries and Sets
Python Dictionaries and SetsPython Dictionaries and Sets
Python Dictionaries and Sets
Nicole Ryan
 
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and AnimationChapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Nicole Ryan
 
Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2
Nicole Ryan
 
Intro to Programming: Modularity
Intro to Programming: ModularityIntro to Programming: Modularity
Intro to Programming: Modularity
Nicole Ryan
 
Programming Logic and Design: Arrays
Programming Logic and Design: ArraysProgramming Logic and Design: Arrays
Programming Logic and Design: Arrays
Nicole Ryan
 
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with DataProgramming Logic and Design: Working with Data
Programming Logic and Design: Working with Data
Nicole Ryan
 
Setting up your development environment
Setting up your development environmentSetting up your development environment
Setting up your development environment
Nicole Ryan
 
Dynamic vs static
Dynamic vs staticDynamic vs static
Dynamic vs static
Nicole Ryan
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
Nicole Ryan
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
Nicole Ryan
 
Tables and forms accessibility and microformats
Tables and forms accessibility and microformatsTables and forms accessibility and microformats
Tables and forms accessibility and microformats
Nicole Ryan
 
Creating and styling forms
Creating and styling formsCreating and styling forms
Creating and styling forms
Nicole Ryan
 
Creating and styling tables
Creating and styling tablesCreating and styling tables
Creating and styling tables
Nicole Ryan
 
Files and Directories in PHP
Files and Directories in PHPFiles and Directories in PHP
Files and Directories in PHP
Nicole Ryan
 
Handling User Input and Processing Form Data
Handling User Input and Processing Form DataHandling User Input and Processing Form Data
Handling User Input and Processing Form Data
Nicole Ryan
 

More from Nicole Ryan (16)

Inheritance
InheritanceInheritance
Inheritance
 
Python Dictionaries and Sets
Python Dictionaries and SetsPython Dictionaries and Sets
Python Dictionaries and Sets
 
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and AnimationChapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
 
Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2Chapter 11: Object Oriented Programming Part 2
Chapter 11: Object Oriented Programming Part 2
 
Intro to Programming: Modularity
Intro to Programming: ModularityIntro to Programming: Modularity
Intro to Programming: Modularity
 
Programming Logic and Design: Arrays
Programming Logic and Design: ArraysProgramming Logic and Design: Arrays
Programming Logic and Design: Arrays
 
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with DataProgramming Logic and Design: Working with Data
Programming Logic and Design: Working with Data
 
Setting up your development environment
Setting up your development environmentSetting up your development environment
Setting up your development environment
 
Dynamic vs static
Dynamic vs staticDynamic vs static
Dynamic vs static
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
Using arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing informationUsing arrays with PHP for forms and storing information
Using arrays with PHP for forms and storing information
 
Tables and forms accessibility and microformats
Tables and forms accessibility and microformatsTables and forms accessibility and microformats
Tables and forms accessibility and microformats
 
Creating and styling forms
Creating and styling formsCreating and styling forms
Creating and styling forms
 
Creating and styling tables
Creating and styling tablesCreating and styling tables
Creating and styling tables
 
Files and Directories in PHP
Files and Directories in PHPFiles and Directories in PHP
Files and Directories in PHP
 
Handling User Input and Processing Form Data
Handling User Input and Processing Form DataHandling User Input and Processing Form Data
Handling User Input and Processing Form Data
 

Recently uploaded

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

Getting Started with CSS

  • 2. Objectives Assess style rules Create an embedded style sheet Implement an ID selector Implement a class selector Use multiple selectors HTML 5 and CSS 3 – Illustrated Complete 2
  • 3. Objectives (continued) Create an external style sheet Link to an external style sheet Add a comment to a style sheet Debug and validate CSS code HTML 5 and CSS 3 – Illustrated Complete 3
  • 4. Assess Style Rules CSS (Cascading Style Sheets): adds style information to elements defined in HTML code Style rules: lines or blocks of CSS code that specify the presentation of web page elements Declarations: basic building block of CSS, includes a property name and a value, e.g. text-align: center HTML 5 and CSS 3 – Illustrated Complete 4
  • 5. Assess Style Rules (continued) Style rules contain two main parts  Selectors: identify the HTML elements to which the rule applies  Declarations: specify CSS property to apply to the selector and value to assign to the property • Each declaration (property: value) ends with a semicolon • All declarations surrounded by curly braces HTML 5 and CSS 3 – Illustrated Complete 5
  • 6. Assess Style Rules (continued) CSS style rule CSS properties and values HTML 5 and CSS 3 – Illustrated Complete 6
  • 7. Create an Embedded Style Sheet Embedded Style Sheet: CSS code inserted in the head element of an HTML document  Most straightforward method for affecting the presentation of a single web page  Generally used only with a single web page  Labor intensive to update embedded styles if added to lots of web pages HTML 5 and CSS 3 – Illustrated Complete 7
  • 8. Create an Embedded Style Sheet (continued) Embedded style rule and resulting web page HTML 5 and CSS 3 – Illustrated Complete 8
  • 9. Implement an ID Selector id selector: affects the presentation of a specific HTML element Add id attribute to opening tag of an HTML element to give it a unique value • e.g., <p id=“name”> John Smith </p> Use # and id value to create CSS id selector for a style rule • e.g., #name {text-align: right;} HTML 5 and CSS 3 – Illustrated Complete 9
  • 10. Implement an ID Selector (continued) Style rule using id selector HTML 5 and CSS 3 – Illustrated Complete 10
  • 11. Implement an ID Selector (continued) Presentation resulting from use of ID selector HTML 5 and CSS 3 – Illustrated Complete 11
  • 12. Implement a Class Selector class attribute: can be assigned to multiple HTML elements class selector: creates a style rule based on values assigned to the class attribute  Allows style rule to be applied to unlimited number of separate elements  Consists of period followed by class attribute value; e.g. .accent HTML 5 and CSS 3 – Illustrated Complete 12
  • 13. Implement a class Selector (continued) class attribute and style rule with class selector added HTML 5 and CSS 3 – Illustrated Complete 13
  • 14. Implement a class Selector (continued) Presentation resulting from use of class selector HTML 5 and CSS 3 – Illustrated Complete 14
  • 15. Use Multiple Selectors Multiple selectors allow you to add the same style rule to multiple HTML elements  Type selector name, comma, space (optional), next selector name  Type a curly brace, followed by the declaration(s), followed by a curly brace HTML 5 and CSS 3 – Illustrated Complete 15
  • 16. Use Multiple Selectors (continued) Commonly used CSS selectors HTML 5 and CSS 3 – Illustrated Complete 16
  • 17. Create an External Style Sheet External style sheet: separate file containing style information  Suitable for maintaining a consistent style in large websites  Prevents need to implement style changes on each page of website  Changes made to external style sheet are reflected in all web pages linked to that style sheet  Can be linked to multiple HTML pages HTML 5 and CSS 3 – Illustrated Complete 17
  • 18. Create an External Style Sheet (continued) An external style sheet HTML 5 and CSS 3 – Illustrated Complete 18
  • 19. Link to an External Style Sheet Use the HTML link element to link an HTML document to an external style sheet, e.g.  <link rel=“stylesheet” href=“mystylesheet.css” /> Attributes of the link element HTML 5 and CSS 3 – Illustrated Complete 19
  • 20. Link to an External Style Sheet (continued) Web page linked to an external style sheet and the style sheet HTML 5 and CSS 3 – Illustrated Complete 20
  • 21. Link to an External Style Sheet (continued) Multiple pages styled by external style sheet HTML 5 and CSS 3 – Illustrated Complete 21
  • 22. Add a Comment to a Style Sheet Use comments in CSS style sheet to document the file Syntax for style sheet comments  /* for opening tag  [comment text]  */ for closing tag Format for style sheet comments  Can be single line  Can be multi-line HTML 5 and CSS 3 – Illustrated Complete 22
  • 23. Add a Comment to a Style Sheet (continued) Style sheet with comment added HTML 5 and CSS 3 – Illustrated Complete 23
  • 24. Debug and Validate CSS Code Important to debug and validate CSS code against CSS rules even when CSS code works in browser testing  Helps ensure compatibility of code with different user agents  Helps ensure that code remains usable You can use online tools to validate your code HTML 5 and CSS 3 – Illustrated Complete 24
  • 25. Debug and Validate CSS Code (continued) Use developer tools to debug code, such as developer tools in Chrome HTML 5 and CSS 3 – Illustrated Complete 25
  • 26. Debug and Validate CSS Code (continued) Use online service to validate CSS code, such as W3C validation service page HTML 5 and CSS 3 – Illustrated Complete 26
  • 27. Summary HTML and CSS are complementary languages  HTML specifies the page content  CSS indicates how the content should be displayed CSS uses style rules  Selector, which identifies the HTML element  Declaration, which includes a property name and a value HTML 5 and CSS 3 – Illustrated Complete 27
  • 28. Summary (continued) Different types of selectors affect different groups of elements  Type selector: applies to all HTML elements of a specific type, such as h1  id selector: applies to a single element having a specific unique id  class selector: applies to elements with a value specific to the class attribute  Multiple selectors: applies the same rule(s) to different elements HTML 5 and CSS 3 – Illustrated Complete 28
  • 29. Summary (continued) Embedded style sheets are included in the HTML code  Suitable for single page websites External style sheets can be linked to multiple web pages  All linked web pages can be changed by changing a single style sheet Use the link element to link a web page to a CSS style sheet HTML 5 and CSS 3 – Illustrated Complete 29
  • 30. Summary (continued) Use comments to document the style sheet  /* [comment text] */ Use developer tools to debug CSS code Use online validation service to validate CSS code against CSS rules HTML 5 and CSS 3 – Illustrated Complete 30