Skip to content

Commit

Permalink
Add a small definition of Block container. (mdn#24298)
Browse files Browse the repository at this point in the history
Add a small note about `Block container`.
  • Loading branch information
ambujsahu81 authored Mar 5, 2023
1 parent b586acc commit a0dc6df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion files/en-us/web/css/containing_block/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ As noted above, when certain properties are given a percentage value, the comput
1. The {{cssxref("height")}}, {{cssxref("top")}}, and {{cssxref("bottom")}} properties compute percentage values from the `height` of the containing block.
2. The {{cssxref("width")}}, {{cssxref("left")}}, {{cssxref("right")}}, {{cssxref("padding")}}, and {{cssxref("margin")}} properties compute percentage values from the `width` of the containing block.

> **Note:** A **block container** (such as an inline-block, block, or list-item element) either contains only inline-level boxes participating in an inline formatting context, or only block-level boxes participating in a block formatting context. An element is a block container only if it contains block-level or inline-level boxes.
## Some examples

The HTML code for all our examples is:
Expand All @@ -65,7 +67,7 @@ Only the CSS is altered in each instance below.

### Example 1

In this example, the paragraph is statically positioned, so its containing block is {{HTMLElement("section")}} because it's the nearest ancestor that is a block container.
In this example, the paragraph is statically positioned, so its containing block is {{HTMLElement("section")}} because it's the nearest ancestor that is a block container (because of `display: block`).

```html hidden
<body>
Expand Down

0 comments on commit a0dc6df

Please sign in to comment.