SlideShare a Scribd company logo
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Chapter 4
1 2
3 4
5 6
What Is CSS? CSS Syntax
Location of
Styles
Selectors
The Cascade: How
Styles Interact
The Box Model
7
CSS Text Styling
8
Summary
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
The “Cascade” in CSS refers to how conflicting rules
are handled.
The downward movement of water down a cascade is
meant to be analogous to how a given style rule will
continue to take precedence with child elements
CSS uses the following cascade principles to help it
deal with conflicts:
• inheritance,
• specificity, and
• location
CSS
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Many (but not all) CSS properties affect not only themselves but their descendants as
well.
Are inheritable:
• Font,
• color,
• list, and
• text properties
Not inheritable:
• layout,
• sizing,
• border,
• background, and
• spacing properties
Inheritance
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Inheritance
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Inheritance
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Specificity
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Specificity
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Specificity Algorithm
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Cascade: How Styles Interact
Location
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Chapter 4
1 2
3 4
5 6
What Is CSS? CSS Syntax
Location of
Styles
Selectors
The Cascade: How
Styles Interact
The Box Model
7
CSS Text Styling
8
Summary
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Overview
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
• Background
• Background-attachment
• Background-color
• Background-image
• Background-position
• Background-repeat
• Background-size
Background
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Background
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Collapsing Margins
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
border-top-color: red; /* sets just the top side */
border-right-color: green; /* sets just the right side */
border-bottom-color: yellow; /* sets just the bottom side */
border-left-color: blue; /* sets just the left side */
Alternately, we can set all four sides at once:
border-color: red; /* sets all four sides to red */
border-color: red green orange blue; /* sets 4 colors */
CSS TRBL Shortcut
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Box Dimensions
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Limitations of Height Property
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Overflow Property
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Box Sizing Using Percents
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
The Box Model
Inspecting CSS using modern browsers
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Chapter 4
1 2
3 4
5 6
What Is CSS? CSS Syntax
Location of
Styles
Selectors
The Cascade: How
Styles Interact
The Box Model
7
CSS Text Styling
8
Summary
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Property Description
font A combined shorthand property that allows you to
set the family, style, size, variant, and weight in one
property.
style weight variant size font-family
font-family Specifies the typeface/font to use. More than one
can be specified.
font-size The size of the font in one of the measurement
units
font-style Specifies whether italic, oblique, or normal
font-variant Specifies either small-caps text or none
font-weight Specifies either normal, bold, bolder, lighter, or a
value between 100 and 900 in multiples of 100,
where larger number represents
weightier (i.e., bolder) text.
Font Family
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Specifying the Font Family
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Different Font Families
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Font Sizes
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Font Face
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Just as there are properties that affect the font in CSS,
there are also a range of CSS properties that affect text
independently of the font.
• letter-spacing
• line-height
• text-align
• text-decoration
• text-diretion
• text-shadow
• …
Paragraph Properties
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
CSS Text Styling
Just look at text-shadow
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Chapter 4
1 2
3 4
5 6
What Is CSS? CSS Syntax
Location of
Styles
Selectors
The Cascade: How
Styles Interact
The Box Model
7
CSS Text Styling
8
Summary
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Summary
absolute units
attribute selector
author-created style
sheets
box model
browser style sheets
cascade
class selector
collapsing margins
combinators
contextual selector
CSS
CSS3 modules
declaration
declaration block
descendant selector
element box
element selectors
em units
embedded style
sheets
external style sheets
Key Terms
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Summary
generic font
grouped selector
id selector
inheritance
inline styles
internal styles
location
margin
padding
percentages
presentation
property:value pair
pseudo-class selector
pseudo-element
selector
relative units
rem units
responsive design
selector
specificity
style rules
TRouBLe
universal element
selector
user style sheets
vendor prefixes
web font stack
x-height
Key Terms
Fundamentals of Web Development - 2nd Ed.
Randy Connolly and Ricardo Hoar
Questions

More Related Content

Similar to lec 6 Advance CSS (Introduction CSS Part B).pdf (20)

PPT
Css present
MissaGiles
 
PDF
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
PDF
CSS preprocessor: why and how
mirahman
 
PPTX
Responsive web design with html5 and css3
Divya Tiwari
 
PPTX
Css
Nasla C.K
 
PPTX
Chapter04-web.pptx
ssuserf3db48
 
PPT
Spectrum 2015 going online with style - an intro to css
Neil Perlin
 
PPTX
Week11 Lecture: CSS
Katherine McCurdy-Lapierre, R.G.D.
 
PDF
2 introduction css
Jalpesh Vasa
 
PDF
The Future Of CSS
Andy Budd
 
PPTX
Unit-3-CSS-BWT.pptx
Tanu524249
 
PPTX
uptu web technology unit 2 Css
Abhishek Kesharwani
 
KEY
CSS Framework + Progressive Enhacements
Mario Hernandez
 
PPT
css
sonam1602
 
PDF
Html and css easy steps
Biswa Ranjan
 
PDF
Html css
mohamed ashraf
 
KEY
Advanced sass/compass
Nick Cooley
 
PDF
slides-students-C04.pdf
MonkeyDLuffy708724
 
PPT
Web design-workflow
Peter Kaizer
 
Css present
MissaGiles
 
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
CSS preprocessor: why and how
mirahman
 
Responsive web design with html5 and css3
Divya Tiwari
 
Chapter04-web.pptx
ssuserf3db48
 
Spectrum 2015 going online with style - an intro to css
Neil Perlin
 
2 introduction css
Jalpesh Vasa
 
The Future Of CSS
Andy Budd
 
Unit-3-CSS-BWT.pptx
Tanu524249
 
uptu web technology unit 2 Css
Abhishek Kesharwani
 
CSS Framework + Progressive Enhacements
Mario Hernandez
 
Html and css easy steps
Biswa Ranjan
 
Html css
mohamed ashraf
 
Advanced sass/compass
Nick Cooley
 
slides-students-C04.pdf
MonkeyDLuffy708724
 
Web design-workflow
Peter Kaizer
 

Recently uploaded (20)

PPTX
Clinical Audit Template - Revised nutrition icu.pptx
pavankumar104378
 
PPTX
Radiological diagnosis of Gastric carcinoma
abid hossain
 
PPTX
Urinary Tract Infection by Dr. Reazoan.pptx
Reazoan Hossain Soikat
 
PPTX
Revision Total Hip Replacement (THR): Surgical Principles, Techniques, and Bo...
Dr. Prabhat Pandey
 
PDF
vaccine & immunotherepy. Types of Vaccine
PRASHANT YADAV
 
PDF
Cognitive Code: Integrating AI into Mental Health Practice
alishbae86
 
PDF
NOI E L’EUROPA - Capolavoro (Parte II).pdf
Emanuele915564
 
PDF
Disability Support Services Melbourne - Comfort Support Care
NDISProviderMelbourn
 
PPT
Trending-Now_-Ayurvedic-Bone-Regeneration-Therapies-for-AVN-_2025_.ppt
khephioisols
 
PPTX
Comprehensive Overview of Trauma Management and Emergency Care
Dr. Prabhat Pandey
 
PPTX
Soft Tissue Injury/Handling in orthopedics.
Dr. Prabhat Pandey
 
PPTX
Burns types and its management .pptx
Rishika Rawat
 
PDF
Antihistaminic_agents & Autocoids .pdf
Prerana Jadhav
 
PPTX
Mastering Clean Claim Ratio: A Key to Smoother A/R Management
Ragnar Lothbrok
 
PDF
Ambulatory Infusion Devices Market, Key Drivers and Innovations Transforming ...
ganeshdukare428
 
PPTX
renal failure in children -child health nsg.pptx
Shibili Abraham
 
PDF
Empowering Parents: A Comprehensive Parenting Program
MyChildTherapy
 
PPTX
Otitis Media.pptx:-  “It is an infection & inflammation of middle ear that m...
Mr. Sudhir Singh Associate Professor ( MSN)
 
PPTX
Ayurveda: Ancient Wisdom for Modern Wellness
Nutrazin
 
PPTX
Acetabular Labral Tears: Anatomy, Diagnosis, and Management
Dr. Prabhat Pandey
 
Clinical Audit Template - Revised nutrition icu.pptx
pavankumar104378
 
Radiological diagnosis of Gastric carcinoma
abid hossain
 
Urinary Tract Infection by Dr. Reazoan.pptx
Reazoan Hossain Soikat
 
Revision Total Hip Replacement (THR): Surgical Principles, Techniques, and Bo...
Dr. Prabhat Pandey
 
vaccine & immunotherepy. Types of Vaccine
PRASHANT YADAV
 
Cognitive Code: Integrating AI into Mental Health Practice
alishbae86
 
NOI E L’EUROPA - Capolavoro (Parte II).pdf
Emanuele915564
 
Disability Support Services Melbourne - Comfort Support Care
NDISProviderMelbourn
 
Trending-Now_-Ayurvedic-Bone-Regeneration-Therapies-for-AVN-_2025_.ppt
khephioisols
 
Comprehensive Overview of Trauma Management and Emergency Care
Dr. Prabhat Pandey
 
Soft Tissue Injury/Handling in orthopedics.
Dr. Prabhat Pandey
 
Burns types and its management .pptx
Rishika Rawat
 
Antihistaminic_agents & Autocoids .pdf
Prerana Jadhav
 
Mastering Clean Claim Ratio: A Key to Smoother A/R Management
Ragnar Lothbrok
 
Ambulatory Infusion Devices Market, Key Drivers and Innovations Transforming ...
ganeshdukare428
 
renal failure in children -child health nsg.pptx
Shibili Abraham
 
Empowering Parents: A Comprehensive Parenting Program
MyChildTherapy
 
Otitis Media.pptx:-  “It is an infection & inflammation of middle ear that m...
Mr. Sudhir Singh Associate Professor ( MSN)
 
Ayurveda: Ancient Wisdom for Modern Wellness
Nutrazin
 
Acetabular Labral Tears: Anatomy, Diagnosis, and Management
Dr. Prabhat Pandey
 
Ad

lec 6 Advance CSS (Introduction CSS Part B).pdf

  • 1. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Chapter 4 1 2 3 4 5 6 What Is CSS? CSS Syntax Location of Styles Selectors The Cascade: How Styles Interact The Box Model 7 CSS Text Styling 8 Summary
  • 2. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact The “Cascade” in CSS refers to how conflicting rules are handled. The downward movement of water down a cascade is meant to be analogous to how a given style rule will continue to take precedence with child elements CSS uses the following cascade principles to help it deal with conflicts: • inheritance, • specificity, and • location CSS
  • 3. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Many (but not all) CSS properties affect not only themselves but their descendants as well. Are inheritable: • Font, • color, • list, and • text properties Not inheritable: • layout, • sizing, • border, • background, and • spacing properties Inheritance
  • 4. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Inheritance
  • 5. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Inheritance
  • 6. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Specificity
  • 7. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Specificity
  • 8. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Specificity Algorithm
  • 9. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Cascade: How Styles Interact Location
  • 10. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Chapter 4 1 2 3 4 5 6 What Is CSS? CSS Syntax Location of Styles Selectors The Cascade: How Styles Interact The Box Model 7 CSS Text Styling 8 Summary
  • 11. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Overview
  • 12. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model • Background • Background-attachment • Background-color • Background-image • Background-position • Background-repeat • Background-size Background
  • 13. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Background
  • 14. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Collapsing Margins
  • 15. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model border-top-color: red; /* sets just the top side */ border-right-color: green; /* sets just the right side */ border-bottom-color: yellow; /* sets just the bottom side */ border-left-color: blue; /* sets just the left side */ Alternately, we can set all four sides at once: border-color: red; /* sets all four sides to red */ border-color: red green orange blue; /* sets 4 colors */ CSS TRBL Shortcut
  • 16. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Box Dimensions
  • 17. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Limitations of Height Property
  • 18. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Overflow Property
  • 19. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Box Sizing Using Percents
  • 20. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar The Box Model Inspecting CSS using modern browsers
  • 21. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Chapter 4 1 2 3 4 5 6 What Is CSS? CSS Syntax Location of Styles Selectors The Cascade: How Styles Interact The Box Model 7 CSS Text Styling 8 Summary
  • 22. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Property Description font A combined shorthand property that allows you to set the family, style, size, variant, and weight in one property. style weight variant size font-family font-family Specifies the typeface/font to use. More than one can be specified. font-size The size of the font in one of the measurement units font-style Specifies whether italic, oblique, or normal font-variant Specifies either small-caps text or none font-weight Specifies either normal, bold, bolder, lighter, or a value between 100 and 900 in multiples of 100, where larger number represents weightier (i.e., bolder) text. Font Family
  • 23. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Specifying the Font Family
  • 24. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Different Font Families
  • 25. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Font Sizes
  • 26. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Font Face
  • 27. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Just as there are properties that affect the font in CSS, there are also a range of CSS properties that affect text independently of the font. • letter-spacing • line-height • text-align • text-decoration • text-diretion • text-shadow • … Paragraph Properties
  • 28. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar CSS Text Styling Just look at text-shadow
  • 29. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Chapter 4 1 2 3 4 5 6 What Is CSS? CSS Syntax Location of Styles Selectors The Cascade: How Styles Interact The Box Model 7 CSS Text Styling 8 Summary
  • 30. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Summary absolute units attribute selector author-created style sheets box model browser style sheets cascade class selector collapsing margins combinators contextual selector CSS CSS3 modules declaration declaration block descendant selector element box element selectors em units embedded style sheets external style sheets Key Terms
  • 31. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Summary generic font grouped selector id selector inheritance inline styles internal styles location margin padding percentages presentation property:value pair pseudo-class selector pseudo-element selector relative units rem units responsive design selector specificity style rules TRouBLe universal element selector user style sheets vendor prefixes web font stack x-height Key Terms
  • 32. Fundamentals of Web Development - 2nd Ed. Randy Connolly and Ricardo Hoar Questions