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;
}

More Related Content

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

How to Create flex box and design box model for a particular section
How to Create flex box and design box model for a particular sectionHow to Create flex box and design box model for a particular section
How to Create flex box and design box model for a particular section
ferdouszihadph
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
Css box-model
Css box-modelCss box-model
Css box-model
Webtech Learning
 
11--CSS-Box-Model.pdf for second college
11--CSS-Box-Model.pdf for second college11--CSS-Box-Model.pdf for second college
11--CSS-Box-Model.pdf for second college
shwan it
 
Web programming css
Web programming cssWeb programming css
Web programming css
Uma mohan
 
CSS BOX MODEL
CSS BOX MODELCSS BOX MODEL
CSS BOX MODEL
mohanaps
 
Dimensions of elements.pdf
Dimensions of elements.pdfDimensions of elements.pdf
Dimensions of elements.pdf
Kongu Engineering College, Perundurai, Erode
 
CHAPTER 3_ Getting Started with CSS Module
CHAPTER 3_ Getting Started with CSS ModuleCHAPTER 3_ Getting Started with CSS Module
CHAPTER 3_ Getting Started with CSS Module
ssusera4f8281
 
Box Model and Page Layouts
Box Model and Page LayoutsBox Model and Page Layouts
Box Model and Page Layouts
Vidya Ananthanarayanan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
GDI Seattle Intro to HTML and CSS - Class 3
GDI Seattle Intro to HTML and CSS - Class 3GDI Seattle Intro to HTML and CSS - Class 3
GDI Seattle Intro to HTML and CSS - Class 3
Heather Rock
 
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
ZahouAmel1
 
Web Layout
Web LayoutWeb Layout
Web Layout
Shawn Calvert
 
Layout with CSS
Layout with CSSLayout with CSS
Layout with CSS
Mike Crabb
 
cascading style sheets explaining about borders
cascading style sheets explaining about borderscascading style sheets explaining about borders
cascading style sheets explaining about borders
Hshhdvrjdnkddb
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
kjkleindorfer
 
Css presentation lecture 4
Css presentation lecture 4Css presentation lecture 4
Css presentation lecture 4
Mudasir Syed
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 
Advance Css
Advance CssAdvance Css
Advance Css
vijayta
 
The Box Model [CSS Introduction]
The Box Model [CSS Introduction]The Box Model [CSS Introduction]
The Box Model [CSS Introduction]
Nicole Ryan
 
How to Create flex box and design box model for a particular section
How to Create flex box and design box model for a particular sectionHow to Create flex box and design box model for a particular section
How to Create flex box and design box model for a particular section
ferdouszihadph
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
11--CSS-Box-Model.pdf for second college
11--CSS-Box-Model.pdf for second college11--CSS-Box-Model.pdf for second college
11--CSS-Box-Model.pdf for second college
shwan it
 
Web programming css
Web programming cssWeb programming css
Web programming css
Uma mohan
 
CSS BOX MODEL
CSS BOX MODELCSS BOX MODEL
CSS BOX MODEL
mohanaps
 
CHAPTER 3_ Getting Started with CSS Module
CHAPTER 3_ Getting Started with CSS ModuleCHAPTER 3_ Getting Started with CSS Module
CHAPTER 3_ Getting Started with CSS Module
ssusera4f8281
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
GDI Seattle Intro to HTML and CSS - Class 3
GDI Seattle Intro to HTML and CSS - Class 3GDI Seattle Intro to HTML and CSS - Class 3
GDI Seattle Intro to HTML and CSS - Class 3
Heather Rock
 
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
ZahouAmel1
 
Layout with CSS
Layout with CSSLayout with CSS
Layout with CSS
Mike Crabb
 
cascading style sheets explaining about borders
cascading style sheets explaining about borderscascading style sheets explaining about borders
cascading style sheets explaining about borders
Hshhdvrjdnkddb
 
Css presentation lecture 4
Css presentation lecture 4Css presentation lecture 4
Css presentation lecture 4
Mudasir Syed
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 
Advance Css
Advance CssAdvance Css
Advance Css
vijayta
 
The Box Model [CSS Introduction]
The Box Model [CSS Introduction]The Box Model [CSS Introduction]
The Box Model [CSS Introduction]
Nicole Ryan
 

Recently uploaded (20)

CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
Sritoma Majumder
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
A Brief Introduction About Jack Lutkus
A Brief Introduction About  Jack  LutkusA Brief Introduction About  Jack  Lutkus
A Brief Introduction About Jack Lutkus
Jack Lutkus
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
Mani Sasidharan
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
CBSE - Grade 11 - Mathematics - Ch 2 - Relations And Functions - Notes (PDF F...
Sritoma Majumder
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
Pharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptxPharmaceutical_Incompatibilities.pptx
Pharmaceutical_Incompatibilities.pptx
Shantanu Ranjan
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
A Brief Introduction About Jack Lutkus
A Brief Introduction About  Jack  LutkusA Brief Introduction About  Jack  Lutkus
A Brief Introduction About Jack Lutkus
Jack Lutkus
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Freckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptxFreckle Project April 2025 Survey and report May 2025.pptx
Freckle Project April 2025 Survey and report May 2025.pptx
EveryLibrary
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
AR3201 WORLD ARCHITECTURE AND URBANISM EARLY CIVILISATIONS TO RENAISSANCE QUE...
Mani Sasidharan
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
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; }