Homework 3

What is the CSS box model?

The CSS box model is essentially a box that wraps around every HTML eelement. It consists of margins, borders, padding, and the content. The content is where the text and images appear. The padding clears an area around the content. The border goes around the padding and content. The margin clears an area outside the border.

What is the difference between margin and padding?

Margins are transparent and are used for clearing area outside the border. The margin is the outermost element in the CSS box model. Padding is also transparent and is used for clearing an area around the content. Paddding makes room inside of the border around the content, whereas margins make room outside the border.

How is the total height and width of an HTML element determined?

The total width of an element is calculated like so:
Total element width = width + left padding + right padding + left border + right border + left margin + right margin
The total height of an element is calculated like so:
Total element height = height + top padding + bottom padding + top border + bottom border + top margin + bottom margin

Explain this CSS property: padding: 25px 50px;

There are top, right, bottom, and left padding properties. The "padding" property is a shorthand for the properties listed prior. Padding: 25px, 50px; has a top and bottom padding of 25px, and a right and left padding of 50px.