SlideShare a Scribd company logo
1 of 18
What is the box model?
Every element can be
represented by a
rectangular box
The box model describes how we
can affect those boxes and how
the boxes affect each other
How do we describe a
box?
A box has a content area
with a width and height
It also has an outer edge ⤴
← width: →
min-width:
max-width:
↑
height:
min-height:
max-height:
↓
A box has padding
Padding has an outer edge ⤴ ↑
padding-top
↓
↑
padding-bottom
↓
← →
padding-right
← →
padding-left
Content edge
A box has a border
The border has an outer edge ⤵
Content edge
Padding edge
A box has margin
Margin has an outer edge ⤵
↑
margin-top
↓
↑
margin-bottom
↓
← →
margin-right
← →
margin-left
Content edge
Padding edge
Chase dog then run away, lick arm hair, claw drapes, so hide head under
blanket so no one can see. Stare at the wall, play with food and get
confused by dust, bathe private parts with tongue then lick owner's face
put butt in owner's face. Lick butt and make a weird face.Caticus
cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human,
attack dog, run away and pretend to be victim. See owner, run in terror
ignore the squirrels, you'll never catch them anyway so peer out window,
chatter at birds, lure them to mouth, chew on cable so present belly,
scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur
on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the
warm chair right after you get up, plan steps for world domination, paw at
your fat belly. Computer screen cat is love.
Chase dog then run away, lick arm hair, claw drapes, so hide head under
blanket so no one can see. Stare at the wall, play with food and get
confused by dust, bathe private parts with tongue then lick owner's face
put butt in owner's face. Lick butt and make a weird face.Caticus
cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human,
attack dog, run away and pretend to be victim. See owner, run in terror
ignore the squirrels, you'll never catch them anyway so peer out window,
chatter at birds, lure them to mouth, chew on cable so present belly,
scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur
on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the
warm chair right after you get up, plan steps for world domination, paw at
your fat belly. Computer screen cat is love.
.container {
width: 600px;
padding: 20px;
border: 5px solid #333;
background-color: #fff;
}
Chase dog then run away, lick arm hair, claw drapes, so hide head under
blanket so no one can see. Stare at the wall, play with food and get
confused by dust, bathe private parts with tongue then lick owner's face
put butt in owner's face. Lick butt and make a weird face.Caticus
cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human,
attack dog, run away and pretend to be victim. See owner, run in terror
ignore the squirrels, you'll never catch them anyway so peer out window,
chatter at birds, lure them to mouth, chew on cable so present belly,
scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur
on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the
warm chair right after you get up, plan steps for world domination, paw at
your fat belly. Computer screen cat is love.
20 600 20
640
Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall,
play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's
face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip
human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch
them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand
when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic
bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer
screen cat is love.
Play riveting piece on synthesizer keyboard lick the other cats so paw at beetle and eat it before it gets away white cat
sleeps on a black shirt or unwrap toilet paper for poop on grasses yet jump off balcony, onto stranger's head. Intently
stare at the same spot sleep on dog bed, force dog to sleep on floor roll on the floor purring your whiskers off,
There is a better way
box-sizing: border-box
Chase dog then run away, lick arm hair, claw drapes, so hide head under
blanket so no one can see. Stare at the wall, play with food and get
confused by dust, bathe private parts with tongue then lick owner's face
put butt in owner's face. Lick butt and make a weird face.Caticus
cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human,
attack dog, run away and pretend to be victim. See owner, run in terror
ignore the squirrels, you'll never catch them anyway so peer out window,
chatter at birds, lure them to mouth, chew on cable so present belly,
scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur
on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the
warm chair right after you get up, plan steps for world domination, paw at
your fat belly. Computer screen cat is love.
computed 20
5
20
5
600
.container {
box-sizing: border-box;
width: 600px;
padding: 20px;
border: 5px solid #333;
}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
Thanks Paul!Thaul

More Related Content

Viewers also liked

Jenkins & OpenNebula a CD History - Alberto García
Jenkins & OpenNebula a CD History - Alberto GarcíaJenkins & OpenNebula a CD History - Alberto García
Jenkins & OpenNebula a CD History - Alberto GarcíaOpenNebula Project
 
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...Ayuntamiento de Málaga
 
Kb 2 penilaian dan klasifikasi penyakit pada anak
Kb 2 penilaian dan klasifikasi  penyakit pada anakKb 2 penilaian dan klasifikasi  penyakit pada anak
Kb 2 penilaian dan klasifikasi penyakit pada anakpjj_kemenkes
 
You Can't Type a Concept: Why Keywords Still Matter
You Can't Type a Concept: Why Keywords Still MatterYou Can't Type a Concept: Why Keywords Still Matter
You Can't Type a Concept: Why Keywords Still MatterPeter "Dr. Pete" Meyers
 
Experiencia de usuario en proyectos de internet
Experiencia de usuario en proyectos de internetExperiencia de usuario en proyectos de internet
Experiencia de usuario en proyectos de internetDaniel Torres Burriel
 
The Science of Good Design
The Science of Good DesignThe Science of Good Design
The Science of Good DesignMichel Ferreira
 
Introducción a Experiencia de Usuario para marketing Digital
Introducción a Experiencia de Usuario para marketing DigitalIntroducción a Experiencia de Usuario para marketing Digital
Introducción a Experiencia de Usuario para marketing DigitalMauricio Angulo
 
Buenas Experiencias: Tenaris Careers
Buenas Experiencias: Tenaris CareersBuenas Experiencias: Tenaris Careers
Buenas Experiencias: Tenaris CareersGabriel Celemin
 
Experiencia del usuario_Columna de opinión en Levante-EMV
Experiencia del usuario_Columna de opinión en Levante-EMVExperiencia del usuario_Columna de opinión en Levante-EMV
Experiencia del usuario_Columna de opinión en Levante-EMVJosé María Guijarro y Jorge
 
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...Emiliano Cosenza
 
Planeación de diseño centrado en el usuario: de la experiencia a la percepción
Planeación de diseño centrado en el usuario: de la experiencia a la percepciónPlaneación de diseño centrado en el usuario: de la experiencia a la percepción
Planeación de diseño centrado en el usuario: de la experiencia a la percepciónLuis Carlos Aceves
 
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuario
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuarioUx2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuario
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuarioIvan Wolcan
 
La experiencia del usuario y la arquitectura de información
La experiencia del usuario y la arquitectura de informaciónLa experiencia del usuario y la arquitectura de información
La experiencia del usuario y la arquitectura de informaciónJorge Arango
 
Kristina Mausser, Kina Olé, Stop Publishing in the Dark
Kristina Mausser, Kina Olé, Stop Publishing in the DarkKristina Mausser, Kina Olé, Stop Publishing in the Dark
Kristina Mausser, Kina Olé, Stop Publishing in the Darkshopexpo
 
It's Not You, It's Your Anti-Pattern
It's Not You, It's Your Anti-PatternIt's Not You, It's Your Anti-Pattern
It's Not You, It's Your Anti-PatternFran Diamond
 
Email Marketing in 2020: 20 Predictions from 20 Experts
Email Marketing in 2020: 20 Predictions from 20 ExpertsEmail Marketing in 2020: 20 Predictions from 20 Experts
Email Marketing in 2020: 20 Predictions from 20 ExpertsLitmus
 
How MacGyver Would Do Design Research
How MacGyver Would Do Design ResearchHow MacGyver Would Do Design Research
How MacGyver Would Do Design ResearchM. Jackson Wilkinson
 

Viewers also liked (19)

Jenkins & OpenNebula a CD History - Alberto García
Jenkins & OpenNebula a CD History - Alberto GarcíaJenkins & OpenNebula a CD History - Alberto García
Jenkins & OpenNebula a CD History - Alberto García
 
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...
PARCEMASA RESERVARÁ UNA SUPERFICIE DE 8.000 METROS2 PARA ENTERRAMIENTOS DE CO...
 
Kb 2 penilaian dan klasifikasi penyakit pada anak
Kb 2 penilaian dan klasifikasi  penyakit pada anakKb 2 penilaian dan klasifikasi  penyakit pada anak
Kb 2 penilaian dan klasifikasi penyakit pada anak
 
You Can't Type a Concept: Why Keywords Still Matter
You Can't Type a Concept: Why Keywords Still MatterYou Can't Type a Concept: Why Keywords Still Matter
You Can't Type a Concept: Why Keywords Still Matter
 
Buzz Marketing
Buzz MarketingBuzz Marketing
Buzz Marketing
 
Experiencia de usuario en proyectos de internet
Experiencia de usuario en proyectos de internetExperiencia de usuario en proyectos de internet
Experiencia de usuario en proyectos de internet
 
The Science of Good Design
The Science of Good DesignThe Science of Good Design
The Science of Good Design
 
Introducción a Experiencia de Usuario para marketing Digital
Introducción a Experiencia de Usuario para marketing DigitalIntroducción a Experiencia de Usuario para marketing Digital
Introducción a Experiencia de Usuario para marketing Digital
 
UX Matters
UX MattersUX Matters
UX Matters
 
Buenas Experiencias: Tenaris Careers
Buenas Experiencias: Tenaris CareersBuenas Experiencias: Tenaris Careers
Buenas Experiencias: Tenaris Careers
 
Experiencia del usuario_Columna de opinión en Levante-EMV
Experiencia del usuario_Columna de opinión en Levante-EMVExperiencia del usuario_Columna de opinión en Levante-EMV
Experiencia del usuario_Columna de opinión en Levante-EMV
 
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...
Diseño de la experiencia de usuario para emprendedores tecnológicos - Proyec...
 
Planeación de diseño centrado en el usuario: de la experiencia a la percepción
Planeación de diseño centrado en el usuario: de la experiencia a la percepciónPlaneación de diseño centrado en el usuario: de la experiencia a la percepción
Planeación de diseño centrado en el usuario: de la experiencia a la percepción
 
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuario
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuarioUx2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuario
Ux2012 - ivan wolcan - Innovar desd el diseño de experiencia de usuario
 
La experiencia del usuario y la arquitectura de información
La experiencia del usuario y la arquitectura de informaciónLa experiencia del usuario y la arquitectura de información
La experiencia del usuario y la arquitectura de información
 
Kristina Mausser, Kina Olé, Stop Publishing in the Dark
Kristina Mausser, Kina Olé, Stop Publishing in the DarkKristina Mausser, Kina Olé, Stop Publishing in the Dark
Kristina Mausser, Kina Olé, Stop Publishing in the Dark
 
It's Not You, It's Your Anti-Pattern
It's Not You, It's Your Anti-PatternIt's Not You, It's Your Anti-Pattern
It's Not You, It's Your Anti-Pattern
 
Email Marketing in 2020: 20 Predictions from 20 Experts
Email Marketing in 2020: 20 Predictions from 20 ExpertsEmail Marketing in 2020: 20 Predictions from 20 Experts
Email Marketing in 2020: 20 Predictions from 20 Experts
 
How MacGyver Would Do Design Research
How MacGyver Would Do Design ResearchHow MacGyver Would Do Design Research
How MacGyver Would Do Design Research
 

More from Joanna Franchetti

More from Joanna Franchetti (8)

Web bluetooth
Web bluetoothWeb bluetooth
Web bluetooth
 
Intersection observer for js oxford
Intersection observer for js oxfordIntersection observer for js oxford
Intersection observer for js oxford
 
Lego in a washing machine
Lego in a washing machineLego in a washing machine
Lego in a washing machine
 
CSS in JS for CSS lovers
CSS in JS for CSS loversCSS in JS for CSS lovers
CSS in JS for CSS lovers
 
Your CSS is Awesome
Your CSS is AwesomeYour CSS is Awesome
Your CSS is Awesome
 
How to make your design process agile
How to make your design process agileHow to make your design process agile
How to make your design process agile
 
Don't Panic - Starting Out in Web Development
Don't Panic - Starting Out in Web DevelopmentDon't Panic - Starting Out in Web Development
Don't Panic - Starting Out in Web Development
 
Smacss and bem
Smacss and bemSmacss and bem
Smacss and bem
 

Recently uploaded

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
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 organizationRadu Cotescu
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Box model

  • 1. What is the box model?
  • 2. Every element can be represented by a rectangular box
  • 3. The box model describes how we can affect those boxes and how the boxes affect each other
  • 4. How do we describe a box?
  • 5. A box has a content area with a width and height It also has an outer edge ⤴ ← width: → min-width: max-width: ↑ height: min-height: max-height: ↓
  • 6. A box has padding Padding has an outer edge ⤴ ↑ padding-top ↓ ↑ padding-bottom ↓ ← → padding-right ← → padding-left Content edge
  • 7. A box has a border The border has an outer edge ⤵ Content edge Padding edge
  • 8. A box has margin Margin has an outer edge ⤵ ↑ margin-top ↓ ↑ margin-bottom ↓ ← → margin-right ← → margin-left Content edge Padding edge
  • 9. Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall, play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer screen cat is love.
  • 10. Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall, play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer screen cat is love. .container { width: 600px; padding: 20px; border: 5px solid #333; background-color: #fff; }
  • 11. Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall, play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer screen cat is love. 20 600 20 640
  • 12. Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall, play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer screen cat is love. Play riveting piece on synthesizer keyboard lick the other cats so paw at beetle and eat it before it gets away white cat sleeps on a black shirt or unwrap toilet paper for poop on grasses yet jump off balcony, onto stranger's head. Intently stare at the same spot sleep on dog bed, force dog to sleep on floor roll on the floor purring your whiskers off,
  • 13.
  • 14. There is a better way
  • 16. Chase dog then run away, lick arm hair, claw drapes, so hide head under blanket so no one can see. Stare at the wall, play with food and get confused by dust, bathe private parts with tongue then lick owner's face put butt in owner's face. Lick butt and make a weird face.Caticus cuteicus loves cheeseburgers. Hide at bottom of staircase to trip human, attack dog, run away and pretend to be victim. See owner, run in terror ignore the squirrels, you'll never catch them anyway so peer out window, chatter at birds, lure them to mouth, chew on cable so present belly, scratch hand when stroked or claw drapes. Stare at ceiling light, leave fur on owner’s clothes. Curl into a furry donut. Lick the plastic bag, steal the warm chair right after you get up, plan steps for world domination, paw at your fat belly. Computer screen cat is love. computed 20 5 20 5 600 .container { box-sizing: border-box; width: 600px; padding: 20px; border: 5px solid #333; }
  • 17. html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; }

Editor's Notes

  1. Every element in web design is represented on the page by a rectangular box. The box model describes how we can affect those boxes, and how we can position them on the page. And yet, you’d be surprised by the number of developers who don’t have a good grasp of how to describe it. I’ve seen it bring seasoned developers out in a cold sweat and yet is one of the first things that we try and teach to a student learning CSS. But is is by no means difficult to understand, so let’s go over it now. *
  2. So we said that every element in web design is represented on the page by a rectangular box.
  3. The box model models how we can affect those boxes, how we can style them and space them out on the page, and how they push each other about the page.
  4. So, how do we describe a box?
  5. Firstly, a box has content. This is, unsurprisingly calledl the content area. The content area is the area containing the actual content of the element, be it text, an image or another element. It is located inside of the content edge, its dimensions are width and height, Its properties are width, min-width, max-width,height, min-height and max-height control the content size.
  6. A box can also have padding The padding is located inside the padding edge, and it creates the padding area, The space between the padding and the content edge can be controlled using the padding-top,padding-right, padding-bottom, padding-left and the shorthand padding CSS properties. When the content area has a background, color, or image set on it, this will extend into the padding.
  7. The border area extends the padding area to the area containing the borders. It is the area inside the border edge. This area depends on the size of the border that is defined by the border-width property or the shorthand border.
  8. The margin area extends the border area with an empty area ususally used to separate the element from its neighbors. It is the area inside the margin edge, The size of the margin area is controlled using the margin-top, margin-right, margin-bottom, margin-left and the shorthand margin CSS properties. Ok, so now that we have that down we can start to build up a picture of what our element will look like on the page and how it will fit around the other elements. Maybe something like this
  9. We’ve got our content, our padding, a border and a margin, that you can’t see because it is transparent. This is where we’re going to start running into problems. You see W3C, the people who created CSS, in their infinite wisdom made it work a little counter intuitively. Let’s illustrate the problem
  10. I have a column on my page that is 600px wide. I want to fit the box that I made earlier into it so I set it’s width to 600px * Ok, so lets put the html in there. Wait, what, that wasn’t really what I was looking for. So what happened here? *
  11. Padding, by default is additive to the width of the box. In other words, the width we’ve set is just on the content * the padding will add to that width and we’ll end up with a box that is 340px wide and now it is exploding out of the space we want it to sit inside. Dammit. *
  12. I’m sure those of you who have started your foray into responsive design have run into this problem, I want the element to fill the width of the page, so i set its width to 100%, and I want it to have 20px padding, so I give it that too With padding it is now 100% + 40px? Huh? Oh gods, scrollbars. The horror. What is happening here? Well, the default sizing behaviour for CSS is what is called ‘Content box’. That means that when you set its width, it sets the width of the content. Which imho is a little mad.
  13. If I made this box out of lego and asked you to tell me how wide it was, would you tell me three bricks or 5?! Well content-box would tell me that this was three wide. Who measures this way? So, I could be forgiven for thinking that I’d be able to fit three of them on a backing plate that is 9 wide? Right? They won’t So, what can we do?
  14. Thankfully there is a sane option, whereas the default behaviour is content box, we can override this, and set it to * border box.
  15. This means that everything inside the border is contained within the specified width. Meaning that we can now do this: Width 600px; Padding 20px; Border We could even do width: 100% and it would fill its container So, how do we use border box? In a sensible way? Putting the attribute on every element would be tiresome. I would recommend the method created by our hero and all around good guy Paul Irish:
  16. So, what is happening here? Well we’ve set border box on the html element and told everything to inherit from its parent, using the universal selector. This means that it will take border box too, unless you have specified otherwise elsewhere in your css. Before and after aren’t covered by the universal selector, so we need to explicitly tell them to inherit too. This gives us the box model that we always wanted. You might get up in arms about the universal * selector. Apparently you’ve heard it’s slow. Firstly, it’s not. It is as fast as h1 as a selector. It can be slow when you specifically use it like .foo > *, so don’t do that. Aside from that, you are not allowed to care about the performance of * unless you concatenate all your javascript, have it at the bottom, minify your css and js, gzip all your assets, and losslessly compress all your images. If you aren’t getting 90+ Page Speed scores, it’s way too early to be thinking about selector optimization. So, how do we use this? Well place it at the top of your CSS, or in your reset css file or wherever you are putting your helpers and all of the elements on the page will use border-box instead of content-box. Thanks Paul Thaul