-
Notifications
You must be signed in to change notification settings - Fork 22.7k
/
Copy pathindex.md
73 lines (49 loc) · 2.19 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: <display-outside>
slug: Web/CSS/display-outside
page-type: css-type
browser-compat:
- css.properties.display.block
- css.properties.display.inline
---
{{CSSRef}}
The `<display-outside>` keywords specify the element's outer {{CSSxRef("display")}} type, which is essentially its role in flow layout. These keywords are used as values of the `display` property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the {{CSSxRef("<display-inside>")}} keywords.
## Syntax
Valid `<display-outside>` values:
- `block`
- : The element generates a block element box, generating line breaks both before and after the element when in the normal flow.
- `inline`
- : The element generates one or more inline element boxes that do not generate line breaks before or after themselves. In normal flow, the next element will be on the same line if there is space.
> [!NOTE]
> When browsers encounter a display property with only an **outer** `display` value (e.g., `display: block` or `display: inline`), the inner value defaults to `flow` (e.g., `display: block flow` and `display: inline flow`).
> This is backwards-compatible with single-keyword syntax.
## Formal syntax
{{csssyntax}}
## Examples
In the following example, span elements (normally displayed as inline elements) are set to `display: block` and so break onto new lines and expand to fill their container in the inline dimension.
### HTML
```html
<span>span 1</span> <span>span 2</span>
```
### CSS
```css
span {
display: block;
border: 1px solid rebeccapurple;
}
```
### Result
{{EmbedLiveSample("Examples", 300, 60)}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{CSSxRef("display")}}
- {{CSSxRef("<display-inside>")}}
- {{CSSxRef("<display-listitem>")}}
- {{CSSxRef("<display-internal>")}}
- {{CSSxRef("<display-box>")}}
- {{CSSxRef("<display-legacy>")}}
- [Block and inline layout in normal flow](/en-US/docs/Web/CSS/CSS_display/Block_and_inline_layout_in_normal_flow)
- [Introduction to formatting contexts](/en-US/docs/Web/CSS/CSS_display/Introduction_to_formatting_contexts)