Work in progress

Learn Box Model

Every HTML element is a box. Every HTML element is a box. Every HTML element is a box.

No, seriously, every HTML element is a box.

Each box has content, which can have height and width.

You can squeeze the content inside the box by adding padding.

You can add a border around the outside of the content and padding.

You can create additional invisible space around the border with margin.

This is the box model.

Basic Box Model

The total width and height of an element's box are calculated by summing the content, padding, border, and margin values. Understanding the CSS box model is crucial for creating layouts and positioning elements on a web page. By manipulating the box model's components, you can control the appearance, spacing, and alignment of elements in your design.

Logical Properties

The CSS Logical Property model is an extension of the CSS Box Model that considers the writing mode and direction of a document. It provides a more natural and flexible way to style elements by adapting to the text flow of different languages and layouts.

In the Logical Property model, dimensions, margins, paddings, and borders are defined using the writing mode-relative terms "block" and "inline," rather than the traditional physical terms "top," "right," "bottom," and "left." This allows styles to automatically adjust when the writing mode or direction changes, such as when switching from left-to-right (LTR) to right-to-left (RTL) languages or from horizontal to vertical writing.

Here are the key concepts in the CSS Logical Property model:

CSS Logical Properties provide a more intuitive way to style elements by focusing on the document's structure and flow. This makes it easier to create responsive designs that work well with different writing systems, languages, and layout orientations.

Using logical properties in your stylesheets helps ensure your designs are flexible and adaptable, providing a better user experience for diverse audiences and devices.

Back Next: Layout