SlideShare a Scribd company logo
1 of 20
Download to read offline
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

01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
crgwbr
 

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

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
 
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
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
Fewd week3 slides
Fewd week3 slidesFewd week3 slides
Fewd week3 slides
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
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
 
CSS Frameworks
CSS FrameworksCSS Frameworks
CSS Frameworks
 
Html frames
Html framesHtml frames
Html frames
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
 
card flip
card flip card flip
card flip
 
Introduction to Responsive Design v.2
Introduction to Responsive Design v.2Introduction to Responsive Design v.2
Introduction to Responsive Design v.2
 
Advance Css
Advance CssAdvance Css
Advance Css
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
 
CSS Font & Text style
CSS Font & Text style CSS Font & Text style
CSS Font & Text style
 
Keep calm and let's play CSS3
Keep calm and let's play CSS3Keep calm and let's play CSS3
Keep calm and let's play CSS3
 
Future-Proof Responsive Web Design #RWD
Future-Proof Responsive Web Design #RWDFuture-Proof Responsive Web Design #RWD
Future-Proof Responsive Web Design #RWD
 

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

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
 
2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context2- Learn Flexbox & CSS Grid / Context
2- Learn Flexbox & CSS Grid / Context
 
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
 
15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color15- Learn CSS Fundamentals / Color
15- Learn CSS Fundamentals / Color
 
14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance14- Learn CSS Fundamentals / Inheritance
14- Learn CSS Fundamentals / Inheritance
 
13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity13- Learn CSS Fundamentals / Specificity
13- Learn CSS Fundamentals / Specificity
 
12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group12- Learn CSS Fundamentals / Mix & group
12- Learn CSS Fundamentals / Mix & group
 
11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators11- Learn CSS Fundamentals / Combinators
11- Learn CSS Fundamentals / Combinators
 
10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements10- Learn CSS Fundamentals / Pseudo-elements
10- Learn CSS Fundamentals / Pseudo-elements
 
9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes9- Learn CSS Fundamentals / Pseudo-classes
9- Learn CSS Fundamentals / Pseudo-classes
 
8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors8- Learn CSS Fundamentals / Attribute selectors
8- Learn CSS Fundamentals / Attribute selectors
 
2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting2- Learn HTML Fundamentals / Text Formatting
2- Learn HTML Fundamentals / Text Formatting
 
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
 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 

Recently uploaded

pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
c6eb683559b3
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理
SS
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
AS
 

Recently uploaded (20)

Local Call Girls in Jharsuguda 9332606886 HOT & SEXY Models beautiful and ch...
Local Call Girls in Jharsuguda  9332606886 HOT & SEXY Models beautiful and ch...Local Call Girls in Jharsuguda  9332606886 HOT & SEXY Models beautiful and ch...
Local Call Girls in Jharsuguda 9332606886 HOT & SEXY Models beautiful and ch...
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
 
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
一比一原版(NYU毕业证书)美国纽约大学毕业证学位证书
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理
 
Delivery in 20 Mins Call Girls Cuttack 9332606886 HOT & SEXY Models beautifu...
Delivery in 20 Mins Call Girls Cuttack  9332606886 HOT & SEXY Models beautifu...Delivery in 20 Mins Call Girls Cuttack  9332606886 HOT & SEXY Models beautifu...
Delivery in 20 Mins Call Girls Cuttack 9332606886 HOT & SEXY Models beautifu...
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budgetCall Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
Call Girls Mehdipatnam ( 8250092165 ) Cheap rates call girls | Get low budget
 
Local Call Girls in Gomati 9332606886 HOT & SEXY Models beautiful and charmi...
Local Call Girls in Gomati  9332606886 HOT & SEXY Models beautiful and charmi...Local Call Girls in Gomati  9332606886 HOT & SEXY Models beautiful and charmi...
Local Call Girls in Gomati 9332606886 HOT & SEXY Models beautiful and charmi...
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
一比一原版(Dundee毕业证书)英国爱丁堡龙比亚大学毕业证如何办理
 

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