SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
WEB DEVELOPMENT & DESIGN
FOUNDATIONS WITH HTML5
Chapter 3
Key Concepts

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

1
LEARNING OUTCOMES
 Apply inline, embedded (aka internal), external style sheets
 Configure element, class, id, and contextual selectors
 Use the W3C CSS Validator

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

2
CASCADING STYLE SHEETS (CSS)
 CSS Demo: http://www.csszengarden.com

 CSS:
 Desktop publishing style sheet technology

for Web Dev

 W3C standard => cross-platform

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

3
CSS
ADVANTAGES

Separates style (CSS) from structure

(HTML)

Styles can be stored in a separate file

=> Easier site maintenance

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

4
TYPES OF CASCADING STYLE
SHEETS (1)

External
Embedded (aka Internal)
Inline

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

5
 Inline Styles

CASCADING STYLE SHEETS

◦ body section
◦ HTML style attribute
◦ applies to one element

 Embedded/Internal Styles
◦ head section
◦ HTML style element
◦ applies to entire web page

 External Styles
◦ Separate .css file
◦ Connect to web page w/link element in head section

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

6
CSS SYNTAX
 Style sheets are composed of Style Rules
 Style Rule: Selector & Declaration

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

7
CSS Example
Web page w/ blue text, yellow background:
body { color: blue;
background-color: yellow; }
OR use HEX triple color codes (ch. 7-8, FIT5):
body { color: #0000FF;
background-color: #FFFF00; }

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

8
COMMON
CSS PROPERTIES
 Table 3.1 Common CSS Properties:
◦ background-color
◦ color
◦ font-family
◦ font-size
◦ font-style
◦ font-weight
◦ line-height
◦ margin
◦ text-align
◦ text-decoration
◦ width

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

9
USING COLOR ON WEB PAGES
monitors display color as

intensities of Red/Green/Blue
light
RGB values 0 .. 255
Hexadecimal numbers (base 16)

are shorthand notation:
0 .. 255 == 00 .. FF
Copyright © Terry Felke-Morris

Wednesday, October 23, 13

10
HEXADECIMAL
COLOR VALUES
 # indicates hex digits
 Hex pairs 00 .. FF
 Three hex pairs => RGB as HEX TRIPLE
#000000 black

#FFFFFF white

#FF0000 red

#00FF00 green

#0000FF blue

#CCCCCC grey

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

11
INLINE CSS
 Inline CSS
 Style Attribute
Example:

<h1 style="color:#ff0000">Heading text is red</h1>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

14
CSS EMBEDDED/INTERNAL STYLES
 Style element in head section

=> Internal Style Sheet
 Rules apply to entire web page

<style>
body { background-color: #000000;
color: #FFFFFF;
}
</style>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

16
CSS properties for configuring text:
 font-weight
 font-style
 font-size
 font-family

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

19
THE FONT-FAMILY PROPERTY

p {font-family: Arial, Verdana, “Courier New”, sans-serif;}

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

21
CSS SELECTORS
simple selector

=> selects html element(s)
class selector
=> selects "class" of elements
id selector
=> selects ONE element on a web page
 contextual selector (aka descendent)

=> selects all nested elements

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

23
USING CSS WITH “CLASS”
Define the class:

<style>
.new { color: #FF0000;
font-style: italic;
}
</style>

Apply the class:

<p class=“new”>This is text is red and in italics</p>

<h4 class=“new”>More Red Italics</h4>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

24
USING ID SELECTORS
Define the id Selector:
Web Field Trip:
octothorn, octalthorp,
octatherp, octothorpe (#)

<style>
#new { color: #FF0000;
font-size:2em;
font-style: italic;
}
</style>

Apply the id selector:
<p id=“new”>This is text is red, large, and in italics</p>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

25
CONTEXTUAL SELECTOR
Select element within context of its

container (parent) element.
AKA descendent selector
example applies only to

<style>
#footer a {
color: green;
}
</style>

links located w/in element tagged
id=’footer’

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

26
SPAN ELEMENT
Purpose:
style content inline
no empty space above/below a span
inline display, not block display

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

27
SPAN ELEMENT EXAMPLE
<style>
.companyname { font-weight: bold;
font-size: larger; }
</style>

<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>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

28
EXTERNAL STYLE SHEETS
CSS style rules stored in a .css file
 may contain style rules only
 may not contain any HTML tags

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

29
EXTERNAL STYLE SHEETS 2
Multiple web pages can associate with

the same external style sheet file.
site.css
body {background-color:#E6E6FA;
color:#000000;
font-family:Arial, sans-serif;
font-size:90%; }
h2 { color: #003366; }
.nav { font-size: 16px;
font-weight: bold; }

index.html
clients.html
about.html
Etc…

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

30
EXAMPLE
External Style Sheet: color.css
body { background-color: #0000FF;
color: #FFFFFF;
}

To link 110/p3/demo.html to 110/css/color.css:
<head>
<link rel="stylesheet" href="../css/color.css">
</head>

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

32
CENTERING PAGE CONTENT
WITH CSS
#container { margin-left: auto;
margin-right: auto;
width:80%; }

Example: services.html

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

34
THE “CASCADE”

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

35
W3C CSS VALIDATION
 http://jigsaw.w3.org/css-validator/

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

36
Ch. 3 Assessment:
Learning Outcomes - Know the following

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

37
Ch. 3 Assessment:
Learning Outcomes - Know the following

Copyright © Terry Felke-Morris

Wednesday, October 23, 13

37

Mais conteúdo relacionado

Destaque

Ch. 10 FIT5, CIS 110 13F
Ch. 10 FIT5, CIS 110 13FCh. 10 FIT5, CIS 110 13F
Ch. 10 FIT5, CIS 110 13F
mh-108
 
Radiografi zae
Radiografi zaeRadiografi zae
Radiografi zae
Pak Zaenal
 
Digipack 3rd draft
Digipack 3rd draftDigipack 3rd draft
Digipack 3rd draft
jam3scoles
 
Avoiding top 5 reasons online videos fail
Avoiding top 5 reasons online videos failAvoiding top 5 reasons online videos fail
Avoiding top 5 reasons online videos fail
HuStream Video
 
Mfv ren ch.4
Mfv ren ch.4Mfv ren ch.4
Mfv ren ch.4
65swiss
 

Destaque (16)

Revago20141004 andre - de overtreffende aeonen
Revago20141004 andre - de overtreffende aeonenRevago20141004 andre - de overtreffende aeonen
Revago20141004 andre - de overtreffende aeonen
 
Revago20141004 gerard - gods wijsheid die leidt naar succes
Revago20141004 gerard - gods wijsheid die leidt naar succesRevago20141004 gerard - gods wijsheid die leidt naar succes
Revago20141004 gerard - gods wijsheid die leidt naar succes
 
ATN utk Kedokteran
ATN utk KedokteranATN utk Kedokteran
ATN utk Kedokteran
 
スマートウォッチってどうなん
スマートウォッチってどうなんスマートウォッチってどうなん
スマートウォッチってどうなん
 
Revago20141004 goswin - gods genade zwart op wit
Revago20141004 goswin - gods genade zwart op witRevago20141004 goswin - gods genade zwart op wit
Revago20141004 goswin - gods genade zwart op wit
 
Warner Robins MSA: Potential Market for Industry and Technology Corridor
Warner Robins MSA:  Potential Market for Industry and Technology CorridorWarner Robins MSA:  Potential Market for Industry and Technology Corridor
Warner Robins MSA: Potential Market for Industry and Technology Corridor
 
Shot types
Shot typesShot types
Shot types
 
Ch. 10 FIT5, CIS 110 13F
Ch. 10 FIT5, CIS 110 13FCh. 10 FIT5, CIS 110 13F
Ch. 10 FIT5, CIS 110 13F
 
Radiografi zae
Radiografi zaeRadiografi zae
Radiografi zae
 
Jリーグ.jpの舞台裏(20151021 JAWS-UG 京都 #5)
Jリーグ.jpの舞台裏(20151021 JAWS-UG 京都 #5)Jリーグ.jpの舞台裏(20151021 JAWS-UG 京都 #5)
Jリーグ.jpの舞台裏(20151021 JAWS-UG 京都 #5)
 
Civil Rights: Historical View
Civil Rights: Historical ViewCivil Rights: Historical View
Civil Rights: Historical View
 
Digipack 3rd draft
Digipack 3rd draftDigipack 3rd draft
Digipack 3rd draft
 
Advertstar Performance based affiliate platform Presentation 2015
Advertstar Performance based affiliate platform Presentation 2015Advertstar Performance based affiliate platform Presentation 2015
Advertstar Performance based affiliate platform Presentation 2015
 
Avoiding top 5 reasons online videos fail
Avoiding top 5 reasons online videos failAvoiding top 5 reasons online videos fail
Avoiding top 5 reasons online videos fail
 
Mfv ren ch.4
Mfv ren ch.4Mfv ren ch.4
Mfv ren ch.4
 
Kasvatuskumppanuus
KasvatuskumppanuusKasvatuskumppanuus
Kasvatuskumppanuus
 

Semelhante a Ch. 3 HTML5, CIS 110 13F

Cis145 03 configuring-withcss
Cis145 03 configuring-withcssCis145 03 configuring-withcss
Cis145 03 configuring-withcss
Nicole77777
 
Unit iii css and javascript 1
Unit iii css and javascript 1Unit iii css and javascript 1
Unit iii css and javascript 1
Jesus Obenita Jr.
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
JagadishBabuParri
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
GmachImen
 

Semelhante a Ch. 3 HTML5, CIS 110 13F (20)

Cis145 03 configuring-withcss
Cis145 03 configuring-withcssCis145 03 configuring-withcss
Cis145 03 configuring-withcss
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Design
 
Chapter3
Chapter3Chapter3
Chapter3
 
Web Design Chapter3
Web Design Chapter3Web Design Chapter3
Web Design Chapter3
 
Css
CssCss
Css
 
New Css style
New Css styleNew Css style
New Css style
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Design
 
Ch. 2 HTML5, CIS 110 13F
Ch. 2 HTML5, CIS 110 13FCh. 2 HTML5, CIS 110 13F
Ch. 2 HTML5, CIS 110 13F
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
Chapter3
Chapter3Chapter3
Chapter3
 
Unit iii css and javascript 1
Unit iii css and javascript 1Unit iii css and javascript 1
Unit iii css and javascript 1
 
Unit 2.1
Unit 2.1Unit 2.1
Unit 2.1
 
Chapter 3 - CSS.pdf
Chapter 3 - CSS.pdfChapter 3 - CSS.pdf
Chapter 3 - CSS.pdf
 
Unit 2.1
Unit 2.1Unit 2.1
Unit 2.1
 
cascading style sheet(css).pptx
cascading style sheet(css).pptxcascading style sheet(css).pptx
cascading style sheet(css).pptx
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
 
DSC, html and CSS basics.pptx
DSC, html and CSS basics.pptxDSC, html and CSS basics.pptx
DSC, html and CSS basics.pptx
 
Shyam sunder Rajasthan Computer
Shyam sunder Rajasthan ComputerShyam sunder Rajasthan Computer
Shyam sunder Rajasthan Computer
 
Chapter 7 - Web Design
Chapter 7 - Web DesignChapter 7 - Web Design
Chapter 7 - Web Design
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 

Mais de mh-108 (8)

Ch. 17 FIT5, CIS 110 13F
Ch. 17 FIT5, CIS 110 13FCh. 17 FIT5, CIS 110 13F
Ch. 17 FIT5, CIS 110 13F
 
Ch. 15 FIT5, CIS 110 13F
Ch. 15 FIT5, CIS 110 13FCh. 15 FIT5, CIS 110 13F
Ch. 15 FIT5, CIS 110 13F
 
Ch. 4 FIT5, CIS 110 13F
Ch. 4 FIT5, CIS 110 13FCh. 4 FIT5, CIS 110 13F
Ch. 4 FIT5, CIS 110 13F
 
Ch. 12 FIT5, CIS 110 13F
Ch. 12 FIT5, CIS 110 13FCh. 12 FIT5, CIS 110 13F
Ch. 12 FIT5, CIS 110 13F
 
Ch. 8 FIT5, CIS 110 13F
Ch. 8 FIT5, CIS 110 13FCh. 8 FIT5, CIS 110 13F
Ch. 8 FIT5, CIS 110 13F
 
Ch. 1 HTML5, CIS 110 13F
Ch. 1 HTML5, CIS 110 13FCh. 1 HTML5, CIS 110 13F
Ch. 1 HTML5, CIS 110 13F
 
Ch. 3 FIT5, CIS 110 13F
Ch. 3 FIT5, CIS 110 13FCh. 3 FIT5, CIS 110 13F
Ch. 3 FIT5, CIS 110 13F
 
FIT5 Ch. 5, CIS 110 13F
FIT5 Ch. 5, CIS 110 13FFIT5 Ch. 5, CIS 110 13F
FIT5 Ch. 5, CIS 110 13F
 

Último

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 

Último (20)

A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 

Ch. 3 HTML5, CIS 110 13F

  • 1. WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts Copyright © Terry Felke-Morris Wednesday, October 23, 13 1
  • 2. LEARNING OUTCOMES  Apply inline, embedded (aka internal), external style sheets  Configure element, class, id, and contextual selectors  Use the W3C CSS Validator Copyright © Terry Felke-Morris Wednesday, October 23, 13 2
  • 3. CASCADING STYLE SHEETS (CSS)  CSS Demo: http://www.csszengarden.com  CSS:  Desktop publishing style sheet technology for Web Dev  W3C standard => cross-platform Copyright © Terry Felke-Morris Wednesday, October 23, 13 3
  • 4. CSS ADVANTAGES Separates style (CSS) from structure (HTML) Styles can be stored in a separate file => Easier site maintenance Copyright © Terry Felke-Morris Wednesday, October 23, 13 4
  • 5. TYPES OF CASCADING STYLE SHEETS (1) External Embedded (aka Internal) Inline Copyright © Terry Felke-Morris Wednesday, October 23, 13 5
  • 6.  Inline Styles CASCADING STYLE SHEETS ◦ body section ◦ HTML style attribute ◦ applies to one element  Embedded/Internal Styles ◦ head section ◦ HTML style element ◦ applies to entire web page  External Styles ◦ Separate .css file ◦ Connect to web page w/link element in head section Copyright © Terry Felke-Morris Wednesday, October 23, 13 6
  • 7. CSS SYNTAX  Style sheets are composed of Style Rules  Style Rule: Selector & Declaration Copyright © Terry Felke-Morris Wednesday, October 23, 13 7
  • 8. CSS Example Web page w/ blue text, yellow background: body { color: blue; background-color: yellow; } OR use HEX triple color codes (ch. 7-8, FIT5): body { color: #0000FF; background-color: #FFFF00; } Copyright © Terry Felke-Morris Wednesday, October 23, 13 8
  • 9. COMMON CSS PROPERTIES  Table 3.1 Common CSS Properties: ◦ background-color ◦ color ◦ font-family ◦ font-size ◦ font-style ◦ font-weight ◦ line-height ◦ margin ◦ text-align ◦ text-decoration ◦ width Copyright © Terry Felke-Morris Wednesday, October 23, 13 9
  • 10. USING COLOR ON WEB PAGES monitors display color as intensities of Red/Green/Blue light RGB values 0 .. 255 Hexadecimal numbers (base 16) are shorthand notation: 0 .. 255 == 00 .. FF Copyright © Terry Felke-Morris Wednesday, October 23, 13 10
  • 11. HEXADECIMAL COLOR VALUES  # indicates hex digits  Hex pairs 00 .. FF  Three hex pairs => RGB as HEX TRIPLE #000000 black #FFFFFF white #FF0000 red #00FF00 green #0000FF blue #CCCCCC grey Copyright © Terry Felke-Morris Wednesday, October 23, 13 11
  • 12. INLINE CSS  Inline CSS  Style Attribute Example: <h1 style="color:#ff0000">Heading text is red</h1> Copyright © Terry Felke-Morris Wednesday, October 23, 13 14
  • 13. CSS EMBEDDED/INTERNAL STYLES  Style element in head section => Internal Style Sheet  Rules apply to entire web page <style> body { background-color: #000000; color: #FFFFFF; } </style> Copyright © Terry Felke-Morris Wednesday, October 23, 13 16
  • 14. CSS properties for configuring text:  font-weight  font-style  font-size  font-family Copyright © Terry Felke-Morris Wednesday, October 23, 13 19
  • 15. THE FONT-FAMILY PROPERTY p {font-family: Arial, Verdana, “Courier New”, sans-serif;} Copyright © Terry Felke-Morris Wednesday, October 23, 13 21
  • 16. CSS SELECTORS simple selector => selects html element(s) class selector => selects "class" of elements id selector => selects ONE element on a web page  contextual selector (aka descendent) => selects all nested elements Copyright © Terry Felke-Morris Wednesday, October 23, 13 23
  • 17. USING CSS WITH “CLASS” Define the class: <style> .new { color: #FF0000; font-style: italic; } </style> Apply the class: <p class=“new”>This is text is red and in italics</p> <h4 class=“new”>More Red Italics</h4> Copyright © Terry Felke-Morris Wednesday, October 23, 13 24
  • 18. USING ID SELECTORS Define the id Selector: Web Field Trip: octothorn, octalthorp, octatherp, octothorpe (#) <style> #new { color: #FF0000; font-size:2em; font-style: italic; } </style> Apply the id selector: <p id=“new”>This is text is red, large, and in italics</p> Copyright © Terry Felke-Morris Wednesday, October 23, 13 25
  • 19. CONTEXTUAL SELECTOR Select element within context of its container (parent) element. AKA descendent selector example applies only to <style> #footer a { color: green; } </style> links located w/in element tagged id=’footer’ Copyright © Terry Felke-Morris Wednesday, October 23, 13 26
  • 20. SPAN ELEMENT Purpose: style content inline no empty space above/below a span inline display, not block display Copyright © Terry Felke-Morris Wednesday, October 23, 13 27
  • 21. SPAN ELEMENT EXAMPLE <style> .companyname { font-weight: bold; font-size: larger; } </style> <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> Copyright © Terry Felke-Morris Wednesday, October 23, 13 28
  • 22. EXTERNAL STYLE SHEETS CSS style rules stored in a .css file  may contain style rules only  may not contain any HTML tags Copyright © Terry Felke-Morris Wednesday, October 23, 13 29
  • 23. EXTERNAL STYLE SHEETS 2 Multiple web pages can associate with the same external style sheet file. site.css body {background-color:#E6E6FA; color:#000000; font-family:Arial, sans-serif; font-size:90%; } h2 { color: #003366; } .nav { font-size: 16px; font-weight: bold; } index.html clients.html about.html Etc… Copyright © Terry Felke-Morris Wednesday, October 23, 13 30
  • 24. EXAMPLE External Style Sheet: color.css body { background-color: #0000FF; color: #FFFFFF; } To link 110/p3/demo.html to 110/css/color.css: <head> <link rel="stylesheet" href="../css/color.css"> </head> Copyright © Terry Felke-Morris Wednesday, October 23, 13 32
  • 25. CENTERING PAGE CONTENT WITH CSS #container { margin-left: auto; margin-right: auto; width:80%; } Example: services.html Copyright © Terry Felke-Morris Wednesday, October 23, 13 34
  • 26. THE “CASCADE” Copyright © Terry Felke-Morris Wednesday, October 23, 13 35
  • 27. W3C CSS VALIDATION  http://jigsaw.w3.org/css-validator/ Copyright © Terry Felke-Morris Wednesday, October 23, 13 36
  • 28. Ch. 3 Assessment: Learning Outcomes - Know the following Copyright © Terry Felke-Morris Wednesday, October 23, 13 37
  • 29. Ch. 3 Assessment: Learning Outcomes - Know the following Copyright © Terry Felke-Morris Wednesday, October 23, 13 37