CSS Box Model

Anil Verma
Jan 23, 2021

The CSS box model is a box that wraps around every element. It consists of: margins, borders, padding, and the actual content

Note- The margin is not counted towards the actual size of the box, but affects the total space that the box will take up.

Element width = width + left padding + right padding + left border + right border

Element height = height + top padding + bottom padding + top border + bottom border

CSS height and width Values

auto — browser calculate the height and width. it is the default value.

length — in px, cm em, etc

% — in percent of the containing element

inherit — inherited from its parent value

--

--

Anil Verma

Hi there 👋, I am Anil Verma, a full stack web developer, and JavaScript enthusiast. 👥 Ask me anything about web development. web- https://anilvermaspeaks.in/