SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
WDS
CS KKU
322 432 Web Design Technology
By Yaowaluck Promdee, Sumonta Kasemvilas
Computer Science Khon Kaen University
CSS Box Model
Margin, Padding and Border
Web Design Technology -2015 1
WDS
CS KKU
Web Design Technology -2015 2
Index
•  CSS Border
•  Outline
•  Box model
•  Margin
•  Padding
•  Example
LAB#7
WDS
CS KKU
Web Design Technology -2015 3
margin-bottom
margin-right
margin-left
margin-top
border-bottom
border-right
border-top
border-left
padding-left
padding-top
padding-right
padding-bottom
Clears an area outside the border.
The margin is transparent
Border – A border that goes around the padding and content
Clears an area around the content.
The padding is transparent
ß------------ width---------------
à
ß------height--------à
The content of the box,
where text and images
appear
CSS Box Model
WDS
CS KKU
Web Design Technology -2015 4
Border
border-width is used to set the
width of the border
border-style The border-style
property specifies
what kind of
border to display
none, hidden,
dotted, dashed,
solid, double,
groove, ridge,
inset, outset
value
{!
WDS
CS KKU
Web Design Technology -2015 5
Border
•  border-top-width
•  border-top-style
•  border-top-color
•  border-top
•  border-bottom-width
•  border-bottom-style
•  border-bottom-color
•  border-bottom
Sets all the top
border properties
Sets all the bottom
border properties
WDS
CS KKU
Web Design Technology -2015 6
Border
•  border-right-width
•  border-right-style
•  border-right-color
•  border-right
•  border-left-width
•  border-left-style
•  border-left-color
•  border-left
Sets all the left
border properties
Sets all the right
border properties
WDS
CS KKU
Web Design Technology -2015 7
CSS3 Border
•  border-radius
•  box-shadow
box-shadow: 10px 10px 5px #888888;
WDS
CS KKU
Web Design Technology -2015 8
CSS3 Border
•  border-image
border-image:url(border.png) 30 30 round;
-webkit-border-image:url(border.png) 30 30 round;
/* Safari 5 and older */
-o-border-image:url(border.png) 30 30 round;
/* Opera */
WDS
CS KKU
9
Outline
p {
border: 1px solid red;
outline-style: dotted;
outline-color: #00ff00;
}
Web Design Technology -2015
WDS
CS KKU
Web Design Technology -2015 10
Outline
p {
border: 1px solid red;
outline: green dotted thick;
}
Sets all the outline properties in one
declaration
outline-color
outline-style
outline-width
inherit
Web Design Technology -2015 11
WDS
CS KKU
Example1
This is output. How to code like this?
WDS
CS KKU
Web Design Technology -2015 12
Lists
Lists
•  unordered lists (<ul>) - the list items are marked with bullets
•  ordered lists (<ol>) - the list items are marked with numbers or letters
ol.c { list-style-type: upper-roman; }
ol.d { list-style-type: lower-alpha;}
ul.a {list-style-type: circle; }
ul.b { list-style-type: square;}
o  CSS
o  HTML
I.  CSS
II.  HTML
§  CSS
§  HTML
a.  CSS
b.  HTML
Try it more
WDS
CS KKU
Web Design Technology -2015 13
Margin
The CSS margin properties define the space around elements.
p { margin: 10px 20px 30px 40px; }
/* shortcut margin changed the top 10px, right 20px, bottom 30px and
left margin 40px. */
h1 { margin: 10px; }
h2 { margin: 10px 20px 30px; }
h2 { margin: 10px 20px; }
top right bottom
set all
top and bottom 10px
right and left 20px
Web Design Technology -2015 14
WDS
CS KKU
Example2
Use the margin property to set the top and bottom margins for <h1>
to “10%", and left and right margins to “30%".
p set margin all 10% and border width 3px solid.
WDS
CS KKU
Web Design Technology -2015 15
Padding
The CSS padding properties define the space between the element border
and the element content.
p { padding: 10px 20px 30px 40px; }
/* shortcut padding changed the top 10px, right 20px, bottom 30px and
left margin 40px. */
h1 {padding: 10px; }
h2 { padding: 10px 20px 30px; }
h2 { padding: 10px 20px; }
top right bottom
set all
top and bottom 10px
right and left 20px
WDS
CS KKU
Web Design Technology -2015 16
Example3
Web Design Technology -2015 17
WDS
CS KKU
Create four web pages by display results as
shown in example 1-4.
- You have to finish this assignment in lab hour.
-- Zip All Files > Example 1-4 and name
“Lab7_YourID_Section.zip”
Example4

Contenu connexe

Tendances

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 

Tendances (20)

Design sitemap
Design sitemapDesign sitemap
Design sitemap
 
Good/Bad Web Design
Good/Bad Web DesignGood/Bad Web Design
Good/Bad Web Design
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Responsive web design ppt
Responsive web design pptResponsive web design ppt
Responsive web design ppt
 
SVG - Scalable Vector Graphic
SVG - Scalable Vector GraphicSVG - Scalable Vector Graphic
SVG - Scalable Vector Graphic
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
 
An introduction to bootstrap
An introduction to bootstrapAn introduction to bootstrap
An introduction to bootstrap
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Css
CssCss
Css
 
Rwd ppt
Rwd pptRwd ppt
Rwd ppt
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
 
CSS
CSSCSS
CSS
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 

Similaire à CSS Boc model

Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 

Similaire à CSS Boc model (20)

CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
Lab#7 CSS Box Model
Lab#7 CSS Box ModelLab#7 CSS Box Model
Lab#7 CSS Box Model
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
CSS Grid Layout from the inside out (HTML5DevConf Autumn 2015)
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
 
Slides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptxSlides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptx
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
 
Html css
Html cssHtml css
Html css
 
The Future of CSS
The Future of CSSThe Future of CSS
The Future of CSS
 
IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기
 
03html Css
03html Css03html Css
03html Css
 
Designing Your Next Generation Web Pages with CSS3
Designing Your Next Generation Web Pages with CSS3Designing Your Next Generation Web Pages with CSS3
Designing Your Next Generation Web Pages with CSS3
 
Layout with CSS
Layout with CSSLayout with CSS
Layout with CSS
 
slides-students-C04.pdf
slides-students-C04.pdfslides-students-C04.pdf
slides-students-C04.pdf
 
IBM Connect 2016 - AD1548 - Building Responsive XPages Applications
IBM Connect 2016 - AD1548 - Building Responsive XPages ApplicationsIBM Connect 2016 - AD1548 - Building Responsive XPages Applications
IBM Connect 2016 - AD1548 - Building Responsive XPages Applications
 
Html Css
Html CssHtml Css
Html Css
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
 

Plus de Yaowaluck Promdee

Plus de Yaowaluck Promdee (20)

A basic of UX for beginner
A basic of UX for beginnerA basic of UX for beginner
A basic of UX for beginner
 
TCAS 2563
TCAS 2563TCAS 2563
TCAS 2563
 
Portfolio design
Portfolio designPortfolio design
Portfolio design
 
Concept to creation story and storyboard
Concept to creation  story and storyboard Concept to creation  story and storyboard
Concept to creation story and storyboard
 
Observation and interviewing
Observation and interviewingObservation and interviewing
Observation and interviewing
 
Requirement gathering-and-lean-canvas
Requirement gathering-and-lean-canvasRequirement gathering-and-lean-canvas
Requirement gathering-and-lean-canvas
 
Good bad design
Good bad designGood bad design
Good bad design
 
Bootstrap Framework
Bootstrap Framework Bootstrap Framework
Bootstrap Framework
 
Graphic, Color and tools
Graphic, Color and toolsGraphic, Color and tools
Graphic, Color and tools
 
Page layouts flexible and fixed layout with CSS
Page layouts flexible and fixed layout with CSSPage layouts flexible and fixed layout with CSS
Page layouts flexible and fixed layout with CSS
 
Style and Selector Part2
Style and Selector Part2Style and Selector Part2
Style and Selector Part2
 
HTML 5
HTML 5HTML 5
HTML 5
 
Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations
 
Web Interface
Web InterfaceWeb Interface
Web Interface
 
Game design
Game designGame design
Game design
 
Powerpoint
Powerpoint Powerpoint
Powerpoint
 
Program Interface
Program Interface Program Interface
Program Interface
 
Mobile Interface
Mobile Interface   Mobile Interface
Mobile Interface
 
Personas and scenario
Personas and scenarioPersonas and scenario
Personas and scenario
 
Ux design process
Ux design processUx design process
Ux design process
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 

CSS Boc model

  • 1. WDS CS KKU 322 432 Web Design Technology By Yaowaluck Promdee, Sumonta Kasemvilas Computer Science Khon Kaen University CSS Box Model Margin, Padding and Border Web Design Technology -2015 1
  • 2. WDS CS KKU Web Design Technology -2015 2 Index •  CSS Border •  Outline •  Box model •  Margin •  Padding •  Example LAB#7
  • 3. WDS CS KKU Web Design Technology -2015 3 margin-bottom margin-right margin-left margin-top border-bottom border-right border-top border-left padding-left padding-top padding-right padding-bottom Clears an area outside the border. The margin is transparent Border – A border that goes around the padding and content Clears an area around the content. The padding is transparent ß------------ width--------------- à ß------height--------à The content of the box, where text and images appear CSS Box Model
  • 4. WDS CS KKU Web Design Technology -2015 4 Border border-width is used to set the width of the border border-style The border-style property specifies what kind of border to display none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset value {!
  • 5. WDS CS KKU Web Design Technology -2015 5 Border •  border-top-width •  border-top-style •  border-top-color •  border-top •  border-bottom-width •  border-bottom-style •  border-bottom-color •  border-bottom Sets all the top border properties Sets all the bottom border properties
  • 6. WDS CS KKU Web Design Technology -2015 6 Border •  border-right-width •  border-right-style •  border-right-color •  border-right •  border-left-width •  border-left-style •  border-left-color •  border-left Sets all the left border properties Sets all the right border properties
  • 7. WDS CS KKU Web Design Technology -2015 7 CSS3 Border •  border-radius •  box-shadow box-shadow: 10px 10px 5px #888888;
  • 8. WDS CS KKU Web Design Technology -2015 8 CSS3 Border •  border-image border-image:url(border.png) 30 30 round; -webkit-border-image:url(border.png) 30 30 round; /* Safari 5 and older */ -o-border-image:url(border.png) 30 30 round; /* Opera */
  • 9. WDS CS KKU 9 Outline p { border: 1px solid red; outline-style: dotted; outline-color: #00ff00; } Web Design Technology -2015
  • 10. WDS CS KKU Web Design Technology -2015 10 Outline p { border: 1px solid red; outline: green dotted thick; } Sets all the outline properties in one declaration outline-color outline-style outline-width inherit
  • 11. Web Design Technology -2015 11 WDS CS KKU Example1 This is output. How to code like this?
  • 12. WDS CS KKU Web Design Technology -2015 12 Lists Lists •  unordered lists (<ul>) - the list items are marked with bullets •  ordered lists (<ol>) - the list items are marked with numbers or letters ol.c { list-style-type: upper-roman; } ol.d { list-style-type: lower-alpha;} ul.a {list-style-type: circle; } ul.b { list-style-type: square;} o  CSS o  HTML I.  CSS II.  HTML §  CSS §  HTML a.  CSS b.  HTML Try it more
  • 13. WDS CS KKU Web Design Technology -2015 13 Margin The CSS margin properties define the space around elements. p { margin: 10px 20px 30px 40px; } /* shortcut margin changed the top 10px, right 20px, bottom 30px and left margin 40px. */ h1 { margin: 10px; } h2 { margin: 10px 20px 30px; } h2 { margin: 10px 20px; } top right bottom set all top and bottom 10px right and left 20px
  • 14. Web Design Technology -2015 14 WDS CS KKU Example2 Use the margin property to set the top and bottom margins for <h1> to “10%", and left and right margins to “30%". p set margin all 10% and border width 3px solid.
  • 15. WDS CS KKU Web Design Technology -2015 15 Padding The CSS padding properties define the space between the element border and the element content. p { padding: 10px 20px 30px 40px; } /* shortcut padding changed the top 10px, right 20px, bottom 30px and left margin 40px. */ h1 {padding: 10px; } h2 { padding: 10px 20px 30px; } h2 { padding: 10px 20px; } top right bottom set all top and bottom 10px right and left 20px
  • 16. WDS CS KKU Web Design Technology -2015 16 Example3
  • 17. Web Design Technology -2015 17 WDS CS KKU Create four web pages by display results as shown in example 1-4. - You have to finish this assignment in lab hour. -- Zip All Files > Example 1-4 and name “Lab7_YourID_Section.zip” Example4