Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Box Model Properties | Box Model
Introduction to CSS Part I
course content

Contenido del Curso

Introduction to CSS Part I

Introduction to CSS Part I

1. Basic Introduction
2. Selectors and Cascade
3. Box Model

Box Model Properties

The box model in CSS specifies the layout and design of elements on a webpage. It is based on the concept of a box surrounding each element, which consists of the following properties:

  • Width and height. These properties specify the element's dimensions. They can be set using absolute units (such as pixels) or relative units (such as percentages or ems);
  • Margin: The margin is the space outside the element's border. It can add space around the element and separate it from other elements on the page. Margins can be set using any of the units mentioned above;
  • Border. The border is a line that surrounds the element and separates it from the margin. It can have a specific width, style (such as solid, dotted, or dashed), and color.
  • Padding. The padding is the space inside the element's border. It can add space around the element's content, such as text or images. Padding can be set using any of the units mentioned above.

A very simplistic representation is given below, which shows how the block-level elements behave when box-model properties are applied to them and how their size gets influenced by these.

¿Todo estuvo claro?

Sección 3. Capítulo 1
We're sorry to hear that something went wrong. What happened?
some-alt