From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-pt/web/css/display/index.html | 707 +++++++++++++++++++++++++++++++++ 1 file changed, 707 insertions(+) create mode 100644 files/pt-pt/web/css/display/index.html (limited to 'files/pt-pt/web/css/display') diff --git a/files/pt-pt/web/css/display/index.html b/files/pt-pt/web/css/display/index.html new file mode 100644 index 0000000000..43db53135e --- /dev/null +++ b/files/pt-pt/web/css/display/index.html @@ -0,0 +1,707 @@ +--- +title: display +slug: Web/CSS/display +tags: + - CSS + - CSS Display + - Propriedade de CSS +translation_of: Web/CSS/display +--- +
{{CSSRef}}
+ +

Esta propriedade display de CSS especifica o tipo de caixa de renderização utilizado para um elemento. Em HTML, os valores da propriedade display predefinidos têm o seu comportamento descrito nas especificações de HTML ou de uma folha de estilo predefinida do navegador ou do utilizador. O valor predefinido no XML é  inline, incluindo os elementos de SVG .

+ +

Em adição aos diferentes tipos de caixa de exibição, o valor none deixa-o desativar a exibição de um elemento; quando utiliza none, todos os elementos descendentes também têm as suas exibições desativadas. O documento é renderizado como se o elemento não existisse na árvore do documento.

+ +
/* <display-outside> values */
+display: block;
+display: inline;
+display: run-in;
+
+/* <display-inside> values */
+display: flow;
+display: flow-root;
+display: table;
+display: flex;
+display: grid;
+display: ruby;
+display: subgrid;
+
+/* <display-outside> plus <display-inside> values */
+display: block flow;
+display: inline table;
+display: flex run-in;
+
+/* <display-listitem> values */
+display: list-item;
+display: list-item block;
+display: list-item inline;
+display: list-item flow;
+display: list-item flow-root;
+display: list-item block flow;
+display: list-item block flow-root;
+display: flow list-item block;
+
+/* <display-internal> values */
+display: table-row-group;
+display: table-header-group;
+display: table-footer-group;
+display: table-row;
+display: table-cell;
+display: table-column-group;
+display: table-column;
+display: table-caption;
+display: ruby-base;
+display: ruby-text;
+display: ruby-base-container;
+display: ruby-text-container;
+
+/* <display-box> values */
+display: contents;
+display: none;
+
+/* <display-legacy> values */
+display: inline-block;
+display: inline-table;
+display: inline-flex;
+display: inline-grid;
+
+/* Global values */
+display: inherit;
+display: initial;
+display: unset;
+
+ +

{{cssinfo}}

+ +

Sintaxe

+ +

A propriedade display é especificada utilizando os valores chave. Os valores chave são agrupados em seis categorias:

+ + + +

Currently it's best to specify display using a single keyword; although the latest specifications allow you to combine some keywords, this is not yet well supported by browsers.

+ +

Valores

+ +
+
<display-outside>
+
These keywords specify the element’s outer display type, which is essentially its role in flow layout. They are defined as follows: + + + + + + + + + + + + + + + + + + + + + +
ValorDescrição
blockThe element generates a block element box.
inlineThe element generates one or more inline element boxes.
run-in {{experimental_inline}}The element generates a run-in box. Run-in elements act like inlines or blocks, depending on the surrounding elements. That is: +
    +
  • If the run-in box contains a block box, same as block.
  • +
  • If a block box follows the run-in box, the run-in box becomes the first inline box of the block box.
  • +
  • If an inline box follows, the run-in box becomes a block box.
  • +
+
+
+
<display-inside>
+
These keywords specify the element’s inner display type, which defines the type of formatting context that lays out its contents (assuming it is a non-replaced element). They are defined as follows: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
flow {{experimental_inline}}The element lays out its contents using flow layout (block-and-inline layout). +

If its outer display type is inline or run-in, and it is participating in a block or inline formatting context, then it generates an inline box. Otherwise it generates a block container box.

+ +

Depending on the value of other properties (such as {{cssxref("position")}}, {{cssxref("float")}}, or {{cssxref("overflow")}}) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context for its contents or integrates its contents into its parent formatting context.

+
flow-root {{experimental_inline}}The element generates a block element box that establishes a new block formatting context.
tableThese elements behave like {{HTMLElement("table")}} HTML elements. It defines a block-level box.
flexThe element behaves like a block element and lays out its content according to the flexbox model.
gridThe element behaves like a block element and lays out its content according to the grid model.
subgrid {{experimental_inline}}If the parent element has display:grid, the element itself and its content are laid out according to the grid model.
ruby {{experimental_inline}}The element behaves like an inline element and lays out its content according to the ruby formatting model. It behaves like the corresponding {{HTMLElement("ruby")}} HTML elements.
+
+
<display-listitem>
+
+

The element generates a block box for the content and a separate list-item inline box.

+ +

If no <display-inside> value is specified, the principal box’s inner display type defaults to flow. If no <display-outside> value is specified, the principal box’s outer display type defaults to block.

+
+
<display-internal>
+
+

Some layout models, such as table and ruby, have a complex internal structure, with several different roles that their children and descendants can fill. This section defines those "internal" display values, which only have meaning within that particular layout mode.

+ +

Unless otherwise specified, both the inner display type and the outer display type of elements using these display values are set to the given keyword.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValorDescrição
table-row-groupThese elements behave like {{HTMLElement("tbody")}} HTML elements
table-header-groupThese elements behave like {{HTMLElement("thead")}} HTML elements.
table-footer-groupThese elements behave like {{HTMLElement("tfoot")}} HTML elements.
table-rowThese elements behave like {{HTMLElement("tr")}} HTML elements.
table-cellThese elements behave like {{HTMLElement("td")}} HTML elements.
table-column-groupThese elements behave like {{HTMLElement("colgroup")}} HTML elements.
table-columnThese elements behave like {{HTMLElement("col")}} HTML elements.
table-captionThese elements behave like {{HTMLElement("caption")}} HTML elements.
ruby-base {{experimental_inline}}These elements behave like {{HTMLElement("rb")}} elements.
ruby-text {{experimental_inline}}These elements behave like {{HTMLElement("rt")}} elements.
ruby-base-container {{experimental_inline}}These elements behave like {{HTMLElement("rbc")}} elements generated as anonymous boxes.
ruby-text-container {{experimental_inline}}These elements behave like {{HTMLElement("rtc")}} elements.
+
+
<display-box>
+
These values define whether an element generates display boxes at all. + + + + + + + + + + + + + + + + + +
ValorDescrição
contents {{experimental_inline}}These elements don't produce a specific box by themselves. They are replaced by their pseudo-box and their child boxes.
none +

Turns off the display of an element so that it has no effect on layout (the document is rendered as though the element did not exist). All descendant elements also have their display turned off.

+ +

To have an element take up the space that it would normally take, but without actually rendering anything, use the {{cssxref("visibility")}} property instead.

+
+
+
<display-legacy>
+
CSS 2 used a single-keyword syntax for the display property, requiring separate keywords for block-level and inline-level variants of the same layout mode. They are defined as follows: + + + + + + + + + + + + + + + + + + + + + + + + + +
ValorDescrição
inline-block +

The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would)

+ +

It is equivalent to inline flow-root.

+
inline-table +

The inline-table value does not have a direct mapping in HTML. It behaves like a {{HTMLElement("table")}} HTML element, but as an inline box, rather than a block-level box. Inside the table box is a block-level context.

+ +

It is equivalent to inline table.

+
inline-flex +

The element behaves like an inline element and lays out its content according to the flexbox model.

+ +

It is equivalent to inline flex.

+
inline-gridThe element behaves like an inline element and lays out its content according to the grid model.
+
+
+ +

Sintaxe formal

+ +
{{csssyntax}}
+ +

Exemplos

+ +

Elementos Hide

+ +

Conteúdo de HTML

+ +
<p>Visible text</p>
+<p class="secret">Invisible text</p>
+ +

Conteúdo de CSS

+ +
p.secret {
+  display: none;
+}
+ +

Resultado

+ +

{{EmbedLiveSample("Hide_element", 300, 60)}}

+ +

View Live Examples

+ +

Especificações

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoEstadoComentário
{{SpecName('CSS3 Display', '#the-display-properties', 'display')}}{{Spec2('CSS3 Display')}}Added run-in, flow, flow-root, contents, and multi-keyword values.
{{SpecName('CSS3 Ruby', '#ruby-display', 'display')}}{{Spec2('CSS3 Ruby')}}Added ruby, ruby-base, ruby-text, ruby-base-container, and ruby-text-container.
{{SpecName('CSS3 Grid', '#grid-containers', 'display')}}{{Spec2('CSS3 Grid')}}Added the grid box model values.
{{SpecName('CSS3 Flexbox', '#flex-containers', 'display')}}{{Spec2('CSS3 Flexbox')}}Added the flexible box model values.
{{SpecName('CSS2.1', 'visuren.html#display-prop', 'display')}}{{Spec2('CSS2.1')}}Added the table model values and inline-block.
{{SpecName('CSS1', '#display', 'display')}}{{Spec2('CSS1')}}Initial definition. Basic values: none, block, inline, and list-item.
+ +

Compatibilidade de navegador

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FuncionalidadeChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
none, inline and block1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}4.07.01.0 (85)
inline-block1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9")}}5.5[4]7.01.0 (85)
list-item1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}6.07.01.0 (85)
run-in {{experimental_inline}}1.0 [5]{{CompatNo}}{{CompatNo}}8.07.01.0 (85)[5]
4.0 Removed in 32Not Blink versions (15 upwards)5.0 (532.5) Removed in 8.0
inline-table1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.9")}}8.07.01.0 (85)
table, table-cell, table-column, table-column-group, table-header-group, table-row-group, table-footer-group, table-row, and table-caption1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}8.0 +

7.0

+
1.0 (85)
flex +

21.0{{property_prefix("-webkit")}}

+ +

29.0

+
{{CompatVersionUnknown}}{{CompatGeckoDesktop("18.0")}}[1]
+ {{CompatGeckoDesktop("20.0")}}
+

10{{property_prefix("-ms")}}[8]
+ 11

+
12.50 +

6.1{{property_prefix("-webkit")}}

+ +

9.0

+
inline-flex21.0{{property_prefix("-webkit")}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("18.0")}}[1]
+ {{CompatGeckoDesktop("20.0")}}
10{{property_prefix("-ms")}}[8]
+ 11
12.506.1{{property_prefix("-webkit")}}
grid {{experimental_inline}}{{CompatChrome(57)}}{{CompatVersionUnknown}}{{property_prefix("-ms")}}{{CompatGeckoDesktop("45.0")}}[6]10.0{{property_prefix("-ms")}}{{CompatOpera(44)}}TP
inline-grid {{experimental_inline}}{{CompatChrome(57)}}{{CompatVersionUnknown}}{{property_prefix("-ms")}}{{CompatGeckoDesktop("45.0")}}[6]10.0{{property_prefix("-ms")}}{{CompatOpera(44)}}TP
subgrid {{experimental_inline}}{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}
ruby, ruby-base, ruby-text, ruby-base-container, ruby-text-container {{experimental_inline}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("34.0")}}[3]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
contents {{experimental_inline}}{{CompatChrome(58)}}[7]{{CompatNo}}{{CompatGeckoDesktop("37")}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}
flow-root{{CompatChrome(58)}}{{CompatUnknown}}{{CompatGeckoDesktop("53.0")}}{{CompatUnknown}}{{CompatOpera(45)}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroid WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}7.0{{property_prefix("-webkit")}}
grid {{experimental_inline}}{{CompatChrome(57)}}{{CompatChrome(57)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatOperaMobile(44)}}{{CompatUnknown}}
inline-grid {{experimental_inline}}{{CompatChrome(57)}}{{CompatChrome(57)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatOperaMobile(44)}}{{CompatUnknown}}
flow-root{{CompatChrome(58)}}{{CompatChrome(58)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatOperaMobile(45)}}{{CompatUnknown}}
+
+ +

[1] To activate flexbox support, for Firefox 18 and 19, the user has to change the about:config preference "layout.css.flexbox.enabled" to true. Multi-line flexbox are supported since Firefox 28.

+ +

[2] Before Firefox 37, the contents value was disabled by default, and could be enabled by setting the layout.css.display-contents.enabled pref to true. In Firefox 37, it was enabled by default, and in Firefox 53 the pref was removed altogether.

+ +

[3] CSS Ruby support is behind pref "layout.css.ruby.enabled". The user has to change this pref to true to activate this.

+ +

[4] In IE < 8, natural inline elements only.

+ +

[5] Not before inline-elements.

+ +

[6] CSS Grid support is unprefixed in Nightly/Alpha builds and behind pref "layout.css.grid.enabled" in Beta/release builds.

+ +

[7] In Chrome, the contents value is currently disabled by default, but can be enabled with the "Experimental Web Platform features" flag.

+ +

[8] In IE 10, only special prefixed values, -ms-flexbox and -ms-inline-flexbox, are recognized.

+ +

Consulte também

+ + + +
+ + + + + +
-- cgit v1.2.3-54-g00ecf