SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
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

Contenu connexe

En vedette

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
 

En vedette (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
 

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

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

Plus 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
 

Dernier

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

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