CSS Box Model

All HTML elements can be considered as boxes. In CSS, the term “box model” is used when talking about design and layout. The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content. The box model allows us to add a border around elements, and to define space between elements. Explanation of the different parts:

  • Margin – Clears an area outside the border. The margin is transparent
  • Border – A border that goes around the padding and content
  • Padding – Clears an area around the content. The padding is transparent
  • Content – The content of the box, where text and images appear

Explanation of the different parts:

The image below illustrates the box model: Example

<!DOCTYPE html>
div {
    background-color: lightgrey;
    width: 700px;
    padding: 25px;
    border: 25px solid navy;
    margin: 25px;

<div>Shiksha360 a unit of Glocal Technologies Pvt.Ltd. invites, MCA/B.E/B.Tech/PGDCA/BCA students wanting to undergo Live Project Training in Lucknow as part of their course curriculum. Our training feature hands-on tasks and real-world scenarios-in few days, you’ll be more productive and embracing new technology standards.</div>




Admin has written 171 articles