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-br/web/css/text-overflow/index.html | 374 +++++++++++++++++++++++++++ 1 file changed, 374 insertions(+) create mode 100644 files/pt-br/web/css/text-overflow/index.html (limited to 'files/pt-br/web/css/text-overflow') diff --git a/files/pt-br/web/css/text-overflow/index.html b/files/pt-br/web/css/text-overflow/index.html new file mode 100644 index 0000000000..e2bfb7d6d7 --- /dev/null +++ b/files/pt-br/web/css/text-overflow/index.html @@ -0,0 +1,374 @@ +--- +title: text-overflow +slug: Web/CSS/text-overflow +translation_of: Web/CSS/text-overflow +--- +

{{ CSSRef() }}

+ +

Sumário

+ +

A propriedade text-overflow do CSS determina como o conteúdo que ultrapassou a sua div e que não é mostrado ao usuário deve ser exibido. Ele pode ser cortado, mostrar reticências ou até mesmo exibir qualquer string definida pelo autor.

+ +

text-overflow.png

+ +

O corte acontece na borda da caixa; para cortar no limite de caracteres de uma string personalizada, pode-se usar ('').

+ +

Essa propriedade afeta apenas o conteúdo que está ultrapassando o bloco ou a div no sentido da linha horizontal (não corta o texto na parte de baixo de um bloco ou div, por exemplo). O texto pode ultrapassar ou transbordar quando utilizado white-space:nowrap’ ou quando uma palavra for muito grande.

+ +

Essa propriedade do CSS não força um estouro para que ele ocorra. Para que isso aconteça, é necessário que o autor utilize algumas propriedades adicionais no elemento, como setar a propriedade overflow para hidden.

+ +

{{cssinfo}}

+ +

Syntaxe

+ +
Formal syntax: {{csssyntax("text-overflow")}}
+ +
/* One-value syntax: the value describe the overflow performed at the end of the line (right end if ltr, left end if rtl) */
+text-overflow: clip
+text-overflow: ellipsis
+text-overflow: "…"
+
+/* Two-value syntax: the first value describes the overflow at the left end of the line,
+                     the second at the right end. Directionality has no influence */
+
+text-overflow: clip ellipsis
+text-overflow: "…" "…"
+
+text-overflow: inherit
+ +

Values

+ +
+
clip
+
This keyword value indicates to truncate the text at the limit of the content area, therefore the truncation can happen in the middle of a character. To truncate at the transition between two characters, the empty string value ('') must be used. The value clip is the default for this property.
+
ellipsis
+
This keyword value indicates to display ellipses ('…', U+2026 Horizontal Ellipsis) to represent clipped text. The ellipsis is displayed inside the content area, shortening more the size of the displayed text. If there is not enough place to display ellipsis, they are clipped.
+
<string> {{ experimental_inline() }}
+
The {{cssxref("<string>")}} to be used to represent clipped text. The string is displayed inside the content area, shortening more the size of the displayed text. If there is not enough place to display the string itself, it is clipped.
+
+ +

Examples

+ +
p {
+  white-space: nowrap;
+  width: 100%;
+  overflow: hidden;              /* "overflow" value must be different from "visible" */
+
+  text-overflow:    ellipsis;
+}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CSS valuedirection: ltrdirection: rtl
Expected ResultLive resultExpected ResultLive result
visible overflow1234567890 +
1234567890
+
0987654321 +
1234567890
+
text-overflow: clipt-o_clip.png +
123456
+
t-o_clip_rtl.png +
1234567890
+
text-overflow: ''12345 +
123456
+
54321 +
1234567890
+
text-overflow: ellipsis1234… +
1234567890
+
…4321 +
1234567890
+
text-overflow: '.'1234. +
1234567890
+
.4321 +
1234567890
+
text-overflow: clip clip123456 +
1234567890
+
654321 +
1234567890
+
text-overflow: clip ellipsis1234… +
1234567890
+
6543… +
1234567890
+
text-overflow: clip '.'1234. +
1234567890
+
6543. +
1234567890
+
text-overflow: ellipsis clip…3456 +
1234567890
+
…4321 +
1234567890
+
text-overflow: ellipsis ellipsis…34… +
1234567890
+
…43… +
1234567890
+
text-overflow: ellipsis '.'…34. +
1234567890
+
…43. +
1234567890
+
text-overflow: ',' clip,3456 +
1234567890
+
,4321 +
1234567890
+
text-overflow: ',' ellipsis,34… +
1234567890
+
,43… +
1234567890
+
text-overflow: ',' '.',34. +
1234567890
+
,53. +
1234567890
+
+ +


+ Using the abbr tag of HTML5 along with text-overflow

+ +

We have the example of the use of abbr tag inside a div with width 250px;

+ +
div {
+    width: 250px;
+    display: inline-block;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    direction: ltr;
+}
+ +
<div>
+    <abbr title="https://developer.mozilla.org/pt-BR/docs/Web/CSS/text-overflow">https://developer.mozilla.org/pt-BR/docs/Web/CSS/text-overflow</abbr>
+</div>
+ +

The full path of the URL will be displayed over the mouse, and the screen will be printed as follows: https://developer.mozilla.org/pt-BR/...

+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{ SpecName('CSS3 UI', '#text-overflow', 'text-overflow') }}{{ Spec2('CSS3 UI') }} 
+ +

A previous version of this interface reached the Candidate Recommendation status. As some not-listed-at-risk features needed to be removed, the spec was demoted to the Working Draft level, explaining why browsers implemented this property unprefixed, though not at the CR state.

+ +

Browser compatibility

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0 (312.3){{ CompatGeckoDesktop("7.0") }} ({{ anch("Gecko notes", "See notes") }})6.0 ({{ anch("Internet Explorer notes", "See notes") }})9{{ property_prefix("-o") }} ({{ anch("Opera notes", "See notes") }})
+ 11.0
1.3 (312.3)
Two-value syntax {{ experimental_inline() }}{{ CompatNo() }}{{ CompatGeckoDesktop("9.0") }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
String value{{ experimental_inline() }}{{ CompatNo() }}{{ CompatGeckoDesktop("9.0") }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{ CompatVersionUnknown() }}{{ CompatGeckoMobile("7.0") }}{{ CompatUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
Two-value syntax {{ experimental_inline() }}{{ CompatNo() }}{{ CompatGeckoMobile("9.0") }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
String value {{ experimental_inline() }}{{ CompatNo() }}{{ CompatGeckoMobile("9.0") }}{{ CompatNo() }}{{ CompatNo() }}{{ CompatNo() }}
+
+ +

Gecko notes

+ +

Starting in Gecko 10.0 {{ geckoRelease("10.0") }}, handling of text-overflow on blocks with inline overflow on both horizontal sides has been corrected; previously, if you specified only one value (such as text-overflow:ellipsis;), ellipsing was happening on both sides instead of just the end edge based on the block's text direction.

+ +

Internet Explorer notes

+ +

Internet Explorer 8 introduced the prefixed version, -ms-text-overflow, synonymous with text-overflow. Do not use this prefixed version.

+ +

Opera notes

+ +

Opera 9 and 10 require the prefixed version, -o-text-overflow.

+ +

See also

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