SlideShare a Scribd company logo
Introduction to CSS
Web Development 101
Lesson 01.02
What you already know
What is “The Web”
What is HTML
What is a DOM
Why the web matters as a technology
01 Introduction To CSS
01 Introduction To CSS
01 Introduction To CSS
01 Introduction To CSS
What we’ll learn
How to change the appearance of HTML
How to control page layout
How to make a single web page look great on multiple devices
au·to·mo·bile
Noun
A road vehicle, typically with four wheels,
powered by an internal combustion engine or
electric motor and able to carry a small number
of people.
Automobile = (Chair + 4 Wheels + Engine)
Early Feature Creep	
Air conditioning

Heated / Cooled Seats

Radio

Tire pressure monitors

Tape Player

Automatic transmission

CD Player

Bluetooth Phone Integration

MP3 Player

Laser Assisted Cruise Control

GPS Navigation

Automatic parallel parking?
Web = (HTML Documents + Hyper Links + Browser)
Web Feature Creep
Pictures

AJAX

Complex layouts

Authenticated User Sessions

Animation

Single Page Applications

Interactivity
Streaming Audio and Video
Forms
A programmer’s job is to manage complexity.
Tools for managing complexity
Modules: separate code into pieces by subject and concern
Layers: abstract complexity into layers. Higher layers build on top of lower
layers. Lower layers hide complexity from higher layers.
Declarative programming: name code by what it accomplishes, not how
it accomplishes it.
parfait

The Web is an onion
Client Side Stack
HTML — Document Content and Structure
CSS — Visual Presentation
Javascript/ECMAScript — Interactivity
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Anatomy of a CSS Rule
.blogPost {
font-size: 13px;
font-family: Helvetica, Arial, sans-serif;
color: #333;
}
Discuss 01.02.01
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>My First Webpage</h1>
<p>Lorem Ipsum</p>
</body>
</html>

html {
font: 13px/1.5 Helvetica, Arial;
color: #333;
}
h1 {
color: #FF0000;
font-size: 20px;
}
Selectors query the DOM
p { ... }

header p { ... }

h1 { ... }

#elem a { ... }

#myElem { ... }

a[href="http://www.jw.org"] { ... }

.someClass { ... }

a:hover { ... }

#parent > .someClass { ... }

a:focus { ... }
Colors are numeric
Colors are 3 or 6 digit hexadecimal numbers.
#FFF, #3FA2BF, #2F798F
Hexadecimal is base-16. {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
One digit is 4 bits (1 nibble, half an octet)
A color is 3 octets (24 bits). 8 bits for each Red, Green, Blue.
BONUS: How many distinct colors can be represented?
#FFFFFF
#000000
#006600
#CC0000

LORIM
LORIM
LORIM
LORIM

IPSUM
IPSUM
IPSUM
IPSUM
Basic Properties
background-color: #FFF;
background-image: url(‘...’);
background-repeat: no-repeat;
border: 1px solid #FFF;
display: block;
font-family: Palatino, Georgia, serif;
font-size: 15px;
font-style: italic;
font-weight: bold;
left: 50px;
margin: 1em 2em 1em 2em;
height: 5em;
max-height: 500px;

max-width: 960px;
min-height: 200px;
min-width: 20em;
opacity: 0.5;
overflow: hidden;
padding: 1em 2em 1em 2em;
position: relative;
right: 20px;
text-align: left;
text-decoration: underline;
width: 400px;
z-index: 4000;
Basic Properties
background-color: #FFF;
background-image: url(‘...’);
background-repeat: no-repeat;
border: 1px solid #FFF;
display: block;
font-family: Palatino, Georgia, serif;
font-size: 15px;
font-style: italic;
font-weight: bold;
left: 50px;
margin: 1em 2em 1em 2em;
height: 5em;
max-height: 500px;

max-width: 960px;
min-height: 200px;
min-width: 20em;
opacity: 0.5;
overflow: hidden;
padding: 1em 2em 1em 2em;
position: relative;
right: 20px;
text-align: left;
text-decoration: underline;
width: 400px;
z-index: 4000;
CSS Box Model
OR
How every element on a web page is a rectangle
01 Introduction To CSS
01 Introduction To CSS
Experiment: Chrome Dev Tools
* {
border: 1px solid red !important;
}
01 Introduction To CSS
Box Model Property Shorthand
#myBox {
top right bottom left
margin: 10px 20px 30px
40px;
}
#yourBox {
margin-top: 10px;
margin-right: 20px;
margin-bottom: 30px;
margin-left: 40px;
}
Dimensions
Pixels (px) are the smallest possible unit on a screen
Percents (%) allow sizing based on the size of the parent container
Ems (em) are equal to the font-size of the parent element
Generally use pixels for fonts & borders. Percents and Ems for layout
Designs must re-flow with the screen. Fixed width is bad practice.
Review
What is CSS?
How do selectors work?
How do you specify colors in CSS?
Whats the box model?
According to the box model, what order is spacing applied in?
What units are available for dimensions?
Discuss 01.02.02
What selector would you use to...
Select the top-level element in the document
Select the `<div>` element with the `container` class
Select all of the links in the document
Select the element with the ID of `title`
Discuss 01.02.03
What elements are being selected?
What colors are being used? How do colors work in CSS?
What kind of font and font styling are being applied?
Whats the difference between width and max-width?
What is margin and padding? How are the similar? How are they different?
Short-hand vs. Long-hand CSS?
Why define the width as a percentage instead of in pixels?
What fonts can you use in CSS? Why are there multiple?
Activity 01.02.03
Customize example 01.02.03 in Chrome Dev Tools.
Change the color on the page to match the color clothing you're
currently wearing.
Increase the font size and change the font style to something with serifs.
Change the distribution of spacing on the page to something you think is
more readable.
Make the first line of a paragraph indented.
Activity 01.02.04
Genesis 1—3 as HTML in project_work folder
Write CSS to:
Make each chapter display as a column
Improve the typography
Improve the colors
Make sizing / spacing more readable
Bonus: Use Media Queries to change layout based on screen width
Homework 01.02
Review: Read Web-Fundamentals-CSS.epub
Get creative: Write CSS for Alice in Wonderland
It should be readable on any screen size
Headings, poems, and paragraphs should be discernible by a visual hierarchy
Too much contrast in colors (text color vs. background color) is difficult to read,
but so is too little.
Tomorrow morning: compare CSS styling of Alice in Wonderland.
What challenges did you face? What did you learn?

More Related Content

PDF
How to use CSS3 in WordPress - Sacramento
PDF
Intro to Sass for WordPress Developers
PDF
DrupalCamp Chattanooga - September 2014 - Sass 101
PDF
Haml And Sass In 15 Minutes
PDF
Web Typography Tips
PDF
Where are (web) designers going with web fonts?
PDF
Le Wagon - Landing page
PDF
Pemrograman Web 2 - CSS
How to use CSS3 in WordPress - Sacramento
Intro to Sass for WordPress Developers
DrupalCamp Chattanooga - September 2014 - Sass 101
Haml And Sass In 15 Minutes
Web Typography Tips
Where are (web) designers going with web fonts?
Le Wagon - Landing page
Pemrograman Web 2 - CSS

What's hot (20)

PPT
Web Design 101
PDF
EPUB Boot Camp: Tips and Tweaks
PDF
Le Wagon - Build your Landing Page in 2 hours
PDF
TMW Code Club – Session 2 - CSS Basics
PDF
Web standards pragmatism - from validation to the real world / Web Developers...
PDF
Building Layouts with CSS
KEY
Artdm171 Week5 Css
PDF
Web Accessibility Gone Wild
PPTX
Moving from Wordpress.com to Wordpress.org - Wordcamp Toronto 2011
PPT
CSS Fundamentals
PPTX
Managing responsive websites with css preprocessors.
PDF
Shaping Up With CSS
ODP
The ABCs of HTML
DOCX
Bad design features
 
PPTX
Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
PDF
Typography For The Web
PDF
Le Wagon Tokyo | Build your Landing Page in 2 hours
KEY
Epub in the wild
PDF
Wordcamp rochester-2017-accessibility-johnson-steigelman
Web Design 101
EPUB Boot Camp: Tips and Tweaks
Le Wagon - Build your Landing Page in 2 hours
TMW Code Club – Session 2 - CSS Basics
Web standards pragmatism - from validation to the real world / Web Developers...
Building Layouts with CSS
Artdm171 Week5 Css
Web Accessibility Gone Wild
Moving from Wordpress.com to Wordpress.org - Wordcamp Toronto 2011
CSS Fundamentals
Managing responsive websites with css preprocessors.
Shaping Up With CSS
The ABCs of HTML
Bad design features
 
Child Theming: An Introduction to Wordpress Theme Development with Wordpres...
Typography For The Web
Le Wagon Tokyo | Build your Landing Page in 2 hours
Epub in the wild
Wordcamp rochester-2017-accessibility-johnson-steigelman
Ad

Viewers also liked (20)

PDF
Lesson 15
PPTX
Workshop 1 - User eXperience evaluation
PPTX
Ifi7174 lesson2
PPTX
Css ms megha
PPTX
How To SASS - af morningtrain.dk
PPTX
Trust workshop
PDF
Lesson 15
PPTX
HTML Lesson 1
PPTX
Developing Interactive systems - lesson 2
PPTX
Ifi7184 lesson3
PPTX
Ifi7174 lesson4
PDF
Lesson 04
PDF
Lesson 11
PDF
CSS for designers - Lesson 1 - HTML
PPTX
IFI7184.DT lesson1- Programming languages
PDF
Lesson 03
PPTX
Ifi7174 lesson3
PPTX
HTML Lesson 5
PDF
Lesson 03
PPTX
A design space for Trust-enabling Interaction Design
Lesson 15
Workshop 1 - User eXperience evaluation
Ifi7174 lesson2
Css ms megha
How To SASS - af morningtrain.dk
Trust workshop
Lesson 15
HTML Lesson 1
Developing Interactive systems - lesson 2
Ifi7184 lesson3
Ifi7174 lesson4
Lesson 04
Lesson 11
CSS for designers - Lesson 1 - HTML
IFI7184.DT lesson1- Programming languages
Lesson 03
Ifi7174 lesson3
HTML Lesson 5
Lesson 03
A design space for Trust-enabling Interaction Design
Ad

Similar to 01 Introduction To CSS (20)

PDF
2 introduction css
PPTX
Web Engineering - Introduction to CSS
PDF
CSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
PPTX
session2_cascading_style_sheet_cssc.pptx
PPTX
session2 cascading style sheet course.pptx
PPTX
session2 css cascade style sheet course.pptx
PDF
Introduction to CSS3
PPTX
Cordova training - Day 2 Introduction to CSS 3
PPTX
Web technologies-course 03.pptx
PDF
Pemrograman Web 3 - CSS Basic Part 2
PPT
gdg_workshop 4 on web development HTML & CSS
PDF
Btk creative-web-03
PDF
Intro to css & sass
DOCX
Css Introduction
PDF
Intro to HTML and CSS - Class 2 Slides
PPTX
css3.0.( Cascading Style Sheets ) pptx
PPTX
CSS Cascade Style Sheet
PPT
CSS - Basics
PPTX
Module 2 CSS . cascading style sheet and its uses
2 introduction css
Web Engineering - Introduction to CSS
CSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
session2_cascading_style_sheet_cssc.pptx
session2 cascading style sheet course.pptx
session2 css cascade style sheet course.pptx
Introduction to CSS3
Cordova training - Day 2 Introduction to CSS 3
Web technologies-course 03.pptx
Pemrograman Web 3 - CSS Basic Part 2
gdg_workshop 4 on web development HTML & CSS
Btk creative-web-03
Intro to css & sass
Css Introduction
Intro to HTML and CSS - Class 2 Slides
css3.0.( Cascading Style Sheets ) pptx
CSS Cascade Style Sheet
CSS - Basics
Module 2 CSS . cascading style sheet and its uses

More from crgwbr (8)

PDF
Lightning Talk: Making JS better with Browserify
PDF
07 Integration Project Part 1
PDF
06 Map Reduce
PDF
05 Web Services
PDF
04 Advanced Javascript
PDF
03 Web Events and jQuery
PDF
02 Introduction to Javascript
PDF
08 Integration Project Part 2
Lightning Talk: Making JS better with Browserify
07 Integration Project Part 1
06 Map Reduce
05 Web Services
04 Advanced Javascript
03 Web Events and jQuery
02 Introduction to Javascript
08 Integration Project Part 2

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Approach and Philosophy of On baking technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
cuic standard and advanced reporting.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Modernizing your data center with Dell and AMD
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
Approach and Philosophy of On baking technology
Empathic Computing: Creating Shared Understanding
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Unlocking AI with Model Context Protocol (MCP)
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Diabetes mellitus diagnosis method based random forest with bat algorithm
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
“AI and Expert System Decision Support & Business Intelligence Systems”
cuic standard and advanced reporting.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
The AUB Centre for AI in Media Proposal.docx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Modernizing your data center with Dell and AMD
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

01 Introduction To CSS

  • 1. Introduction to CSS Web Development 101 Lesson 01.02
  • 2. What you already know What is “The Web” What is HTML What is a DOM Why the web matters as a technology
  • 7. What we’ll learn How to change the appearance of HTML How to control page layout How to make a single web page look great on multiple devices
  • 8. au·to·mo·bile Noun A road vehicle, typically with four wheels, powered by an internal combustion engine or electric motor and able to carry a small number of people.
  • 9. Automobile = (Chair + 4 Wheels + Engine)
  • 10. Early Feature Creep Air conditioning Heated / Cooled Seats Radio Tire pressure monitors Tape Player Automatic transmission CD Player Bluetooth Phone Integration MP3 Player Laser Assisted Cruise Control GPS Navigation Automatic parallel parking?
  • 11. Web = (HTML Documents + Hyper Links + Browser)
  • 12. Web Feature Creep Pictures AJAX Complex layouts Authenticated User Sessions Animation Single Page Applications Interactivity Streaming Audio and Video Forms
  • 13. A programmer’s job is to manage complexity.
  • 14. Tools for managing complexity Modules: separate code into pieces by subject and concern Layers: abstract complexity into layers. Higher layers build on top of lower layers. Lower layers hide complexity from higher layers. Declarative programming: name code by what it accomplishes, not how it accomplishes it.
  • 15. parfait The Web is an onion
  • 16. Client Side Stack HTML — Document Content and Structure CSS — Visual Presentation Javascript/ECMAScript — Interactivity
  • 17. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 18. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 19. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 20. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 21. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 22. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 23. Anatomy of a CSS Rule .blogPost { font-size: 13px; font-family: Helvetica, Arial, sans-serif; color: #333; }
  • 24. Discuss 01.02.01 <!DOCTYPE html> <html> <head> <title>Hello World</title> </head> <body> <h1>My First Webpage</h1> <p>Lorem Ipsum</p> </body> </html> html { font: 13px/1.5 Helvetica, Arial; color: #333; } h1 { color: #FF0000; font-size: 20px; }
  • 25. Selectors query the DOM p { ... } header p { ... } h1 { ... } #elem a { ... } #myElem { ... } a[href="http://www.jw.org"] { ... } .someClass { ... } a:hover { ... } #parent > .someClass { ... } a:focus { ... }
  • 26. Colors are numeric Colors are 3 or 6 digit hexadecimal numbers. #FFF, #3FA2BF, #2F798F Hexadecimal is base-16. {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} One digit is 4 bits (1 nibble, half an octet) A color is 3 octets (24 bits). 8 bits for each Red, Green, Blue. BONUS: How many distinct colors can be represented?
  • 28. Basic Properties background-color: #FFF; background-image: url(‘...’); background-repeat: no-repeat; border: 1px solid #FFF; display: block; font-family: Palatino, Georgia, serif; font-size: 15px; font-style: italic; font-weight: bold; left: 50px; margin: 1em 2em 1em 2em; height: 5em; max-height: 500px; max-width: 960px; min-height: 200px; min-width: 20em; opacity: 0.5; overflow: hidden; padding: 1em 2em 1em 2em; position: relative; right: 20px; text-align: left; text-decoration: underline; width: 400px; z-index: 4000;
  • 29. Basic Properties background-color: #FFF; background-image: url(‘...’); background-repeat: no-repeat; border: 1px solid #FFF; display: block; font-family: Palatino, Georgia, serif; font-size: 15px; font-style: italic; font-weight: bold; left: 50px; margin: 1em 2em 1em 2em; height: 5em; max-height: 500px; max-width: 960px; min-height: 200px; min-width: 20em; opacity: 0.5; overflow: hidden; padding: 1em 2em 1em 2em; position: relative; right: 20px; text-align: left; text-decoration: underline; width: 400px; z-index: 4000;
  • 30. CSS Box Model OR How every element on a web page is a rectangle
  • 33. Experiment: Chrome Dev Tools * { border: 1px solid red !important; }
  • 35. Box Model Property Shorthand #myBox { top right bottom left margin: 10px 20px 30px 40px; } #yourBox { margin-top: 10px; margin-right: 20px; margin-bottom: 30px; margin-left: 40px; }
  • 36. Dimensions Pixels (px) are the smallest possible unit on a screen Percents (%) allow sizing based on the size of the parent container Ems (em) are equal to the font-size of the parent element Generally use pixels for fonts & borders. Percents and Ems for layout Designs must re-flow with the screen. Fixed width is bad practice.
  • 37. Review What is CSS? How do selectors work? How do you specify colors in CSS? Whats the box model? According to the box model, what order is spacing applied in? What units are available for dimensions?
  • 38. Discuss 01.02.02 What selector would you use to... Select the top-level element in the document Select the `<div>` element with the `container` class Select all of the links in the document Select the element with the ID of `title`
  • 39. Discuss 01.02.03 What elements are being selected? What colors are being used? How do colors work in CSS? What kind of font and font styling are being applied? Whats the difference between width and max-width? What is margin and padding? How are the similar? How are they different? Short-hand vs. Long-hand CSS? Why define the width as a percentage instead of in pixels? What fonts can you use in CSS? Why are there multiple?
  • 40. Activity 01.02.03 Customize example 01.02.03 in Chrome Dev Tools. Change the color on the page to match the color clothing you're currently wearing. Increase the font size and change the font style to something with serifs. Change the distribution of spacing on the page to something you think is more readable. Make the first line of a paragraph indented.
  • 41. Activity 01.02.04 Genesis 1—3 as HTML in project_work folder Write CSS to: Make each chapter display as a column Improve the typography Improve the colors Make sizing / spacing more readable Bonus: Use Media Queries to change layout based on screen width
  • 42. Homework 01.02 Review: Read Web-Fundamentals-CSS.epub Get creative: Write CSS for Alice in Wonderland It should be readable on any screen size Headings, poems, and paragraphs should be discernible by a visual hierarchy Too much contrast in colors (text color vs. background color) is difficult to read, but so is too little. Tomorrow morning: compare CSS styling of Alice in Wonderland. What challenges did you face? What did you learn?