Css box model

519 views

Published on

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
519
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Css box model

  1. 1. CSS Box Model
  2. 2. The CSS box model is essentially a box that wraps around HTML elements It consists of: ◦ margins, ◦ borders, ◦ padding, and ◦ the actual content.
  3. 3. Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent Border - A border that goes around the padding and content. The border is affected by the background color of the box Padding - Clears an area around the content. The padding is affected by the background color of the box Content - The content of the box, where text and images appear
  4. 4. The total width of an element should be calculated like this: Total element width = width + left padding + right padding + left border + right border + left margin + right margin width:220px; padding:10px; border:5px solid gray; margin:0px; Total element width = 250 px
  5. 5. CSS Border Property
  6. 6. CSS Margin
  7. 7. The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. The top, right, bottom, and left margin can be changed independently using separate properties.
  8. 8. CSS Padding
  9. 9. The CSS padding properties define the space between the element border and the element content. The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element. The top, right, bottom, and left padding can be changed independently using separate properties.

×