SlideShare a Scribd company logo
Working with the CSS
Box Model
What is the CSS Box Model?
•The box model is a fundamental concept in web
design.
•It defines how elements are structured and how
their dimensions are calculated.
Importance
 Helps control the layout and spacing of
elements on a webpage.
The Components of the Box Model
•Content: The actual content of the element (text,
images, etc.)
•Padding: Space between the content and the border.
•Border: Surrounds the padding (if present) and the
content.
•Margin: Outermost space around the element
(separates elements from each other).
Box Model Properties in CSS
 Width and Height: Defines the content area of the box.
 Padding: Can be set for each side (top, right, bottom,
left).
 Border: Can also be set for each side (top, right,
bottom, left).
 Margin: Sets the space between the box and other
elements.
Box-Sizing Property
•Default Behavior: The default box-sizing is content-box, meaning padding and border
are added to the width/height.
•Alternative Behavior: box-sizing: border-box; includes padding and border within the
element’s width/height, preventing overflow.
•When to use: Use border-box for simpler layouts and to avoid unexpected
overflow.
Working with Box Model in CSS
Example 1: Simple box with padding, border, and margin
.box {
width: 200px;
height: 100px;
padding: 20px;
border: 5px solid #000;
margin: 15px;
}
Ad

Recommended

PPTX
CSS: Box Model
utsav singh
 
PPTX
CSS BOX MODEL
mohanaps
 
PPTX
Css box model
Dhairya Joshi
 
PPTX
Lecture 6.pptx..........................
salmannawaz6566504
 
PPT
gdg_workshop 4 on web development HTML & CSS
SaniyaKhan484230
 
PPTX
Css
shinyduela
 
PPTX
CSS document। .pptx
ayanshaikh0054
 
PPTX
Css box-model
Webtech Learning
 
PPTX
Getting Started With CSS
Trisha Crowley
 
PPTX
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
PPTX
Working-With-The-Box-Model-Lesson-5.pptx
AxestetikrieyHales
 
PPTX
Journey To The Front End World - Part2 - The Cosmetic
Irfan Maulana
 
PDF
Dimensions of elements.pdf
Kongu Engineering College, Perundurai, Erode
 
PPTX
Web Development - Lecture 6
Syed Shahzaib Sohail
 
PDF
Flexbox, Grid and Sass
Seble Nigussie
 
PPTX
Beginners css tutorial for web designers
Singsys Pte Ltd
 
PPT
CSS for basic learner
Yoeung Vibol
 
PPTX
CSS Language
Anna Rita Colella
 
PPTX
WEBD 162: Box Model, Pseudo-Classes and Pseudo-Elements
palomateach
 
PPTX
css3.pptx
ThiyaguPappu
 
PPTX
Css intro
Julia Vi
 
PDF
Web Programming& Scripting Lab
Swapnali Pawar
 
PPTX
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
PPTX
Chapter 11: Intro to CSS
Steve Guinan
 
PPTX
DW unit 3.pptx
SeethaDinesh
 
KEY
Css Essential
Yue Tian
 
PDF
Introduction to Frontend Development - Session 2 - CSS Fundamentals
Kalin Chernev
 
PPTX
ESP 10 Edukasyon sa Pagpapakatao PowerPoint Lessons Quarter 1.pptx
Sir J.
 
PPTX
How Physics Enhances Our Quality of Life.pptx
AngeliqueTolentinoDe
 

More Related Content

Similar to Working with the CSS Box Model, syntaxxx (20)

PPTX
Css box-model
Webtech Learning
 
PPTX
Getting Started With CSS
Trisha Crowley
 
PPTX
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
PPTX
Working-With-The-Box-Model-Lesson-5.pptx
AxestetikrieyHales
 
PPTX
Journey To The Front End World - Part2 - The Cosmetic
Irfan Maulana
 
PDF
Dimensions of elements.pdf
Kongu Engineering College, Perundurai, Erode
 
PPTX
Web Development - Lecture 6
Syed Shahzaib Sohail
 
PDF
Flexbox, Grid and Sass
Seble Nigussie
 
PPTX
Beginners css tutorial for web designers
Singsys Pte Ltd
 
PPT
CSS for basic learner
Yoeung Vibol
 
PPTX
CSS Language
Anna Rita Colella
 
PPTX
WEBD 162: Box Model, Pseudo-Classes and Pseudo-Elements
palomateach
 
PPTX
css3.pptx
ThiyaguPappu
 
PPTX
Css intro
Julia Vi
 
PDF
Web Programming& Scripting Lab
Swapnali Pawar
 
PPTX
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
PPTX
Chapter 11: Intro to CSS
Steve Guinan
 
PPTX
DW unit 3.pptx
SeethaDinesh
 
KEY
Css Essential
Yue Tian
 
PDF
Introduction to Frontend Development - Session 2 - CSS Fundamentals
Kalin Chernev
 
Css box-model
Webtech Learning
 
Getting Started With CSS
Trisha Crowley
 
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
Working-With-The-Box-Model-Lesson-5.pptx
AxestetikrieyHales
 
Journey To The Front End World - Part2 - The Cosmetic
Irfan Maulana
 
Web Development - Lecture 6
Syed Shahzaib Sohail
 
Flexbox, Grid and Sass
Seble Nigussie
 
Beginners css tutorial for web designers
Singsys Pte Ltd
 
CSS for basic learner
Yoeung Vibol
 
CSS Language
Anna Rita Colella
 
WEBD 162: Box Model, Pseudo-Classes and Pseudo-Elements
palomateach
 
css3.pptx
ThiyaguPappu
 
Css intro
Julia Vi
 
Web Programming& Scripting Lab
Swapnali Pawar
 
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
Chapter 11: Intro to CSS
Steve Guinan
 
DW unit 3.pptx
SeethaDinesh
 
Css Essential
Yue Tian
 
Introduction to Frontend Development - Session 2 - CSS Fundamentals
Kalin Chernev
 

Recently uploaded (20)

PPTX
ESP 10 Edukasyon sa Pagpapakatao PowerPoint Lessons Quarter 1.pptx
Sir J.
 
PPTX
How Physics Enhances Our Quality of Life.pptx
AngeliqueTolentinoDe
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PDF
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
PDF
Rapid Mathematics Assessment Score sheet for all Grade levels
DessaCletSantos
 
PPTX
Martyrs of Ireland - who kept the faith of St. Patrick.pptx
Martin M Flynn
 
PPTX
How to Add New Item in CogMenu in Odoo 18
Celine George
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
Nanotechnology and Functional Foods Effective Delivery of Bioactive Ingredien...
rmswlwcxai8321
 
PPTX
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
PDF
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
PDF
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PPTX
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
PDF
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
PPTX
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
PPTX
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
PDF
VCE Literature Section A Exam Response Guide
jpinnuck
 
ESP 10 Edukasyon sa Pagpapakatao PowerPoint Lessons Quarter 1.pptx
Sir J.
 
How Physics Enhances Our Quality of Life.pptx
AngeliqueTolentinoDe
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
Rapid Mathematics Assessment Score sheet for all Grade levels
DessaCletSantos
 
Martyrs of Ireland - who kept the faith of St. Patrick.pptx
Martin M Flynn
 
How to Add New Item in CogMenu in Odoo 18
Celine George
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
Nanotechnology and Functional Foods Effective Delivery of Bioactive Ingredien...
rmswlwcxai8321
 
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
How to Create & Manage Stages in Odoo 18 Helpdesk
Celine George
 
VCE Literature Section A Exam Response Guide
jpinnuck
 
Ad

Working with the CSS Box Model, syntaxxx

  • 1. Working with the CSS Box Model
  • 2. What is the CSS Box Model? •The box model is a fundamental concept in web design. •It defines how elements are structured and how their dimensions are calculated.
  • 3. Importance  Helps control the layout and spacing of elements on a webpage.
  • 4. The Components of the Box Model •Content: The actual content of the element (text, images, etc.) •Padding: Space between the content and the border. •Border: Surrounds the padding (if present) and the content. •Margin: Outermost space around the element (separates elements from each other).
  • 5. Box Model Properties in CSS  Width and Height: Defines the content area of the box.  Padding: Can be set for each side (top, right, bottom, left).  Border: Can also be set for each side (top, right, bottom, left).  Margin: Sets the space between the box and other elements.
  • 6. Box-Sizing Property •Default Behavior: The default box-sizing is content-box, meaning padding and border are added to the width/height. •Alternative Behavior: box-sizing: border-box; includes padding and border within the element’s width/height, preventing overflow. •When to use: Use border-box for simpler layouts and to avoid unexpected overflow.
  • 7. Working with Box Model in CSS Example 1: Simple box with padding, border, and margin .box { width: 200px; height: 100px; padding: 20px; border: 5px solid #000; margin: 15px; }