SlideShare a Scribd company logo
4
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
GOOD
PRACTICE
Pixels are bad for usability:

• they don't scale,

• they don't help other elements
to scale proportionally.
Use them only when you
really need an exact and
fixed size.
EXAMPLE
border: 1px solid #000;
AVOID PIXELS
Most read
6
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE 

UNITS
% Percentage Relative to the parent element’s 

value for that property.
em Em Relative to the current font-size of the element.
rem Root em Relative to the font-size of the root.
ch Character Relative to width of the "0".
vw Viewport width Relative to the width of viewport. 

1vw = 1/100 of the viewport’s width.
vh Viewport height Relative to the height of viewport. 

1vw = 1/100 of the viewport’s height.
vmin Smaller dimension 1vmin = 1/100 of viewport’s 

smaller dimension.
ex x-height Relative to the height of a lower-case x.
vmax Larger dimension 1vmax = 1/100 of viewport’s 

larger dimension.
Most read
10
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / REM vs EM
EM REM
html {font-size: 100%} /* 16px */
h1 {
font-size: 2em;
margin-bottom: 1em;
}
p {
font-size: 1em;
margin-bottom: 1em;
}
/* 1em = 16px */
/* 1em = 32px */
/* 1em = 16px */
/* 1em = 16px */
html {font-size: 100%} /* 16px */
h1 {
font-size: 2rem;
margin-bottom: 1rem;
}
p {
font-size: 1rem;
margin-bottom: 1rem;
}
/* 1em = 16px */
/* 1em = 16px */
/* 1em = 16px */
/* 1em = 16px */
[
[
Most read
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
Units
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ABSOLUTE 

UNITS
RELATIVE 

UNITS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ABSOLUTE 

UNITS
px pixel
1/96 of 1 inch 

(96px = 1 inch)
pt point
1/72 of 1 inch 

(72pt = 1 inch)
pc pica 12pt = 1pc
mm millimeter 1cm = 10mm
cm centimeter 10mm = 1cm
in inch 2.54 cm = 1 inch
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
GOOD
PRACTICE
Pixels are bad for usability:

• they don't scale,

• they don't help other elements
to scale proportionally.
Use them only when you
really need an exact and
fixed size.
EXAMPLE
border: 1px solid #000;
AVOID PIXELS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ABSOLUTE 

UNITS
RELATIVE 

UNITS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE 

UNITS
% Percentage Relative to the parent element’s 

value for that property.
em Em Relative to the current font-size of the element.
rem Root em Relative to the font-size of the root.
ch Character Relative to width of the "0".
vw Viewport width Relative to the width of viewport. 

1vw = 1/100 of the viewport’s width.
vh Viewport height Relative to the height of viewport. 

1vw = 1/100 of the viewport’s height.
vmin Smaller dimension 1vmin = 1/100 of viewport’s 

smaller dimension.
ex x-height Relative to the height of a lower-case x.
vmax Larger dimension 1vmax = 1/100 of viewport’s 

larger dimension.
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / PERCENTAGE
.box { width: 50%; }
container: 1000x
Box
500px
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / EM
.box {
font-size: 2em;
width: 4em;
}
font-size: 20px
Box
20x4
Container text.
20x2
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / REM
:root { font-size: 15px; }
.box {
font-size: 3rem;
width: 6rem;
}
font-size: 20px
Box
15x6
Container text.
15x3
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / REM vs EM
EM REM
html {font-size: 100%} /* 16px */
h1 {
font-size: 2em;
margin-bottom: 1em;
}
p {
font-size: 1em;
margin-bottom: 1em;
}
/* 1em = 16px */
/* 1em = 32px */
/* 1em = 16px */
/* 1em = 16px */
html {font-size: 100%} /* 16px */
h1 {
font-size: 2rem;
margin-bottom: 1rem;
}
p {
font-size: 1rem;
margin-bottom: 1rem;
}
/* 1em = 16px */
/* 1em = 16px */
/* 1em = 16px */
/* 1em = 16px */
[
[
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / VW
.box {
width: 50vw;
}
viewport
Box
50% of the viewport
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / VH
.box {
height: 100vh;
}
viewport
Box
100% of the viewport
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / VMIN
.box {
font-size: 10vmin;
}
width: 1000px
Box 10% of 500px=50px
1vmin = 1vw or 1vh, whichever is smaller.
height: 500px
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
RELATIVE UNITS / VMAX
.box {
font-size: 10vmax;
}
width: 1000px
Box
1vmax = 1vw or 1vh, whichever is larger.
height: 500px
10% of 1000px=100px
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HOW TO CHOOSE A CSS UNIT
Do I need to scale an element when
the viewport size changes?
What do I want it to scale relative to?
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ABSOLUTE 

UNITS
RELATIVE 

UNITS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
TOOLS: TYPE SCALE
Learn front-end development at rocket speed
inarocket.com
by miguelsanchez.com
YOU CAN CONTINUE THIS COURSE FOR FREE ON
+ READY TO USE CODE
+ QUIZZES
+ FREE UPDATES
We respect your time

No more blah blah videos. Just straight to
the point slides with relevant information.
Ready to use code

Real code you can just copy and paste into
your real projects.
Step by step guides

Clear and concise steps to build real use
solutions. No missed points.
Learn front-end development at rocket speed
inarocket.com
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
Units

More Related Content

Similar to 17- Learn CSS Fundamentals / Units (20)

Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
Andreas Bovens
 
Squishy pixels
Squishy pixelsSquishy pixels
Squishy pixels
FITC
 
Spectrum 16 pmc 16 - preparing legacy projects for responsive design
Spectrum 16   pmc 16 - preparing legacy projects for responsive designSpectrum 16   pmc 16 - preparing legacy projects for responsive design
Spectrum 16 pmc 16 - preparing legacy projects for responsive design
Neil Perlin
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
Eduardo Shiota Yasuda
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
Wynn Netherland
 
Web Layout
Web LayoutWeb Layout
Web Layout
Shawn Calvert
 
Fewd week3 slides
Fewd week3 slidesFewd week3 slides
Fewd week3 slides
William Myers
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
crgwbr
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
Ben MacNeill
 
Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022
Thijs Feryn
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
Web Directions
 
Html frames
Html framesHtml frames
Html frames
eShikshak
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
Randy Oest II
 
esponsive web design means that your website (
esponsive web design means that your website (esponsive web design means that your website (
esponsive web design means that your website (
vishal choudhary
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
Holger Bartel
 
card flip
card flip card flip
card flip
slidesharepimp
 
Introduction to Responsive Design v.2
Introduction to Responsive Design v.2Introduction to Responsive Design v.2
Introduction to Responsive Design v.2
Clarissa Peterson
 
intro-to-fluent-tutorial-tutiafflen24.pdf
intro-to-fluent-tutorial-tutiafflen24.pdfintro-to-fluent-tutorial-tutiafflen24.pdf
intro-to-fluent-tutorial-tutiafflen24.pdf
VAIBHAVBANSODE10
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
Andreas Bovens
 
Squishy pixels
Squishy pixelsSquishy pixels
Squishy pixels
FITC
 
Spectrum 16 pmc 16 - preparing legacy projects for responsive design
Spectrum 16   pmc 16 - preparing legacy projects for responsive designSpectrum 16   pmc 16 - preparing legacy projects for responsive design
Spectrum 16 pmc 16 - preparing legacy projects for responsive design
Neil Perlin
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
Eduardo Shiota Yasuda
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
crgwbr
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
Lasha Sumbadze
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
Ben MacNeill
 
Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022
Thijs Feryn
 
esponsive web design means that your website (
esponsive web design means that your website (esponsive web design means that your website (
esponsive web design means that your website (
vishal choudhary
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
Holger Bartel
 
Introduction to Responsive Design v.2
Introduction to Responsive Design v.2Introduction to Responsive Design v.2
Introduction to Responsive Design v.2
Clarissa Peterson
 
intro-to-fluent-tutorial-tutiafflen24.pdf
intro-to-fluent-tutorial-tutiafflen24.pdfintro-to-fluent-tutorial-tutiafflen24.pdf
intro-to-fluent-tutorial-tutiafflen24.pdf
VAIBHAVBANSODE10
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 

More from In a Rocket (15)

3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
In a Rocket
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes
In a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 
3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items3- Learn Flexbox & CSS Grid / Container & items
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup1- Learn Flexbox & CSS Grid / Environment setup
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
In a Rocket
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
In a Rocket
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes
In a Rocket
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes1- Learn HTML Fundamentals / Start in 5 Minutes
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
In a Rocket
 
Ad

Recently uploaded (17)

Networking_Essentials_version_3.0_-_Module_7.pptx
Networking_Essentials_version_3.0_-_Module_7.pptxNetworking_Essentials_version_3.0_-_Module_7.pptx
Networking_Essentials_version_3.0_-_Module_7.pptx
elestirmen
 
MOBILE PHONE DATA presentation with all necessary details
MOBILE PHONE DATA presentation with all necessary detailsMOBILE PHONE DATA presentation with all necessary details
MOBILE PHONE DATA presentation with all necessary details
benamorraj
 
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
treyka
 
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
ICP -2 Review – What It Is, and How to Participate and Provide Your FeedbackICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
APNIC
 
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
CartCoders
 
ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676
areebaimtiazpmas
 
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptxInter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
secretarysocom
 
10 Latest Technologies and Their Benefits to End.pptx
10 Latest Technologies and Their Benefits to End.pptx10 Latest Technologies and Their Benefits to End.pptx
10 Latest Technologies and Their Benefits to End.pptx
EphraimOOghodero
 
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animationUV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
17218
 
How to Make Money as a Cam Model – Tips, Tools & Real Talk
How to Make Money as a Cam Model – Tips, Tools & Real TalkHow to Make Money as a Cam Model – Tips, Tools & Real Talk
How to Make Money as a Cam Model – Tips, Tools & Real Talk
Cam Sites Expert
 
Cloud Computing - iCloud by Hamza Anwaar .pptx
Cloud Computing - iCloud by Hamza Anwaar .pptxCloud Computing - iCloud by Hamza Anwaar .pptx
Cloud Computing - iCloud by Hamza Anwaar .pptx
islamicknowledge5224
 
Google_Cloud_Computing_Fundamentals.pptx
Google_Cloud_Computing_Fundamentals.pptxGoogle_Cloud_Computing_Fundamentals.pptx
Google_Cloud_Computing_Fundamentals.pptx
ektadangwal2005
 
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
Taqyea
 
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdfPredicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Behzad Hussain
 
Vigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptxVigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptx
secretarysocom
 
Internet_of_Things_Presentation_by-Humera.pptx
Internet_of_Things_Presentation_by-Humera.pptxInternet_of_Things_Presentation_by-Humera.pptx
Internet_of_Things_Presentation_by-Humera.pptx
cshumerabashir
 
3D Graphics an introduction and details .pptx
3D Graphics an introduction and details .pptx3D Graphics an introduction and details .pptx
3D Graphics an introduction and details .pptx
islamicknowledge5224
 
Networking_Essentials_version_3.0_-_Module_7.pptx
Networking_Essentials_version_3.0_-_Module_7.pptxNetworking_Essentials_version_3.0_-_Module_7.pptx
Networking_Essentials_version_3.0_-_Module_7.pptx
elestirmen
 
MOBILE PHONE DATA presentation with all necessary details
MOBILE PHONE DATA presentation with all necessary detailsMOBILE PHONE DATA presentation with all necessary details
MOBILE PHONE DATA presentation with all necessary details
benamorraj
 
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...
treyka
 
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
ICP -2 Review – What It Is, and How to Participate and Provide Your FeedbackICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
APNIC
 
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...
CartCoders
 
ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676ARTIFICIAL INTELLIGENCE.pptx2565567765676
ARTIFICIAL INTELLIGENCE.pptx2565567765676
areebaimtiazpmas
 
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptxInter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
secretarysocom
 
10 Latest Technologies and Their Benefits to End.pptx
10 Latest Technologies and Their Benefits to End.pptx10 Latest Technologies and Their Benefits to End.pptx
10 Latest Technologies and Their Benefits to End.pptx
EphraimOOghodero
 
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animationUV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
17218
 
How to Make Money as a Cam Model – Tips, Tools & Real Talk
How to Make Money as a Cam Model – Tips, Tools & Real TalkHow to Make Money as a Cam Model – Tips, Tools & Real Talk
How to Make Money as a Cam Model – Tips, Tools & Real Talk
Cam Sites Expert
 
Cloud Computing - iCloud by Hamza Anwaar .pptx
Cloud Computing - iCloud by Hamza Anwaar .pptxCloud Computing - iCloud by Hamza Anwaar .pptx
Cloud Computing - iCloud by Hamza Anwaar .pptx
islamicknowledge5224
 
Google_Cloud_Computing_Fundamentals.pptx
Google_Cloud_Computing_Fundamentals.pptxGoogle_Cloud_Computing_Fundamentals.pptx
Google_Cloud_Computing_Fundamentals.pptx
ektadangwal2005
 
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
最新版西班牙加泰罗尼亚国际大学毕业证(UIC毕业证书)原版定制
Taqyea
 
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdfPredicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdf
Behzad Hussain
 
Vigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptxVigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptx
secretarysocom
 
Internet_of_Things_Presentation_by-Humera.pptx
Internet_of_Things_Presentation_by-Humera.pptxInternet_of_Things_Presentation_by-Humera.pptx
Internet_of_Things_Presentation_by-Humera.pptx
cshumerabashir
 
3D Graphics an introduction and details .pptx
3D Graphics an introduction and details .pptx3D Graphics an introduction and details .pptx
3D Graphics an introduction and details .pptx
islamicknowledge5224
 
Ad

17- Learn CSS Fundamentals / Units

  • 1. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Units
  • 2. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ABSOLUTE 
 UNITS RELATIVE 
 UNITS
  • 3. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ABSOLUTE 
 UNITS px pixel 1/96 of 1 inch (96px = 1 inch) pt point 1/72 of 1 inch (72pt = 1 inch) pc pica 12pt = 1pc mm millimeter 1cm = 10mm cm centimeter 10mm = 1cm in inch 2.54 cm = 1 inch
  • 4. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com GOOD PRACTICE Pixels are bad for usability: • they don't scale, • they don't help other elements to scale proportionally. Use them only when you really need an exact and fixed size. EXAMPLE border: 1px solid #000; AVOID PIXELS
  • 5. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ABSOLUTE 
 UNITS RELATIVE 
 UNITS
  • 6. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE 
 UNITS % Percentage Relative to the parent element’s value for that property. em Em Relative to the current font-size of the element. rem Root em Relative to the font-size of the root. ch Character Relative to width of the "0". vw Viewport width Relative to the width of viewport. 1vw = 1/100 of the viewport’s width. vh Viewport height Relative to the height of viewport. 1vw = 1/100 of the viewport’s height. vmin Smaller dimension 1vmin = 1/100 of viewport’s smaller dimension. ex x-height Relative to the height of a lower-case x. vmax Larger dimension 1vmax = 1/100 of viewport’s larger dimension.
  • 7. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / PERCENTAGE .box { width: 50%; } container: 1000x Box 500px
  • 8. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / EM .box { font-size: 2em; width: 4em; } font-size: 20px Box 20x4 Container text. 20x2
  • 9. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / REM :root { font-size: 15px; } .box { font-size: 3rem; width: 6rem; } font-size: 20px Box 15x6 Container text. 15x3
  • 10. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / REM vs EM EM REM html {font-size: 100%} /* 16px */ h1 { font-size: 2em; margin-bottom: 1em; } p { font-size: 1em; margin-bottom: 1em; } /* 1em = 16px */ /* 1em = 32px */ /* 1em = 16px */ /* 1em = 16px */ html {font-size: 100%} /* 16px */ h1 { font-size: 2rem; margin-bottom: 1rem; } p { font-size: 1rem; margin-bottom: 1rem; } /* 1em = 16px */ /* 1em = 16px */ /* 1em = 16px */ /* 1em = 16px */ [ [
  • 11. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / VW .box { width: 50vw; } viewport Box 50% of the viewport
  • 12. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / VH .box { height: 100vh; } viewport Box 100% of the viewport
  • 13. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / VMIN .box { font-size: 10vmin; } width: 1000px Box 10% of 500px=50px 1vmin = 1vw or 1vh, whichever is smaller. height: 500px
  • 14. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com RELATIVE UNITS / VMAX .box { font-size: 10vmax; } width: 1000px Box 1vmax = 1vw or 1vh, whichever is larger. height: 500px 10% of 1000px=100px
  • 15. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HOW TO CHOOSE A CSS UNIT Do I need to scale an element when the viewport size changes? What do I want it to scale relative to?
  • 16. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ABSOLUTE 
 UNITS RELATIVE 
 UNITS
  • 17. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com TOOLS: TYPE SCALE
  • 18. Learn front-end development at rocket speed inarocket.com by miguelsanchez.com YOU CAN CONTINUE THIS COURSE FOR FREE ON + READY TO USE CODE + QUIZZES + FREE UPDATES
  • 19. We respect your time
 No more blah blah videos. Just straight to the point slides with relevant information. Ready to use code
 Real code you can just copy and paste into your real projects. Step by step guides
 Clear and concise steps to build real use solutions. No missed points. Learn front-end development at rocket speed inarocket.com
  • 20. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS Units