Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

WDS35 - CSS Box Model

In the last article we learned about width and height properties of CSS in detail and now it's time to see what the Css Box Model is.
Let's begin...

The CSS Box Model

While learning Css Box model we will consider HTML elements as boxes. CSS box model is used to discuss design and layout of boxes that are HTML elements.


CSS box model includes following parts:
  • Content - This is the main and core part of the box. All the text, image, and other content are in this part.
  • Padding - This is the area around the content. The padding is transparent.
  • Border - Boundary around content and padding.
  • Margin - This is the area outside the border. The margin is also transparent.
That's all we have to understand. All the practical usages are already covered in padding and margins. 
Just remember:
Total width of element = width + left margin + left border + left padding + right padding + right border + right margin
Total height of element = height + bottom margin + bottom border + bottom padding + top padding + top border + top margin

That's all for today. Practice using box-model with various examples. You can also practice on Free Code Camp to enhance your skills. In the next part, we will learn about some other CSS properties.
Till then #keepCoding.



This post first appeared on The Coding Express, please read the originial post: here

Share the post

WDS35 - CSS Box Model

×

Subscribe to The Coding Express

Get updates delivered right to your inbox!

Thank you for your subscription

×