Relawan kami belum menerjemahkan artikel ini ke bahasa Bahasa Indonesia. Bergabunglah dan bantu kami menyelesaikannya!
Anda juga dapat membaca artikel ini dalam English (US).

The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box.

Note: In contrast to overflow-wrap, word-break will create a break at the exact place where text would otherwise overflow its container (even if putting an entire word on its own line would negate the need for a break).

Syntax

/* Keyword values */
word-break: normal; 
word-break: break-all; 
word-break: keep-all;
word-break: break-word; /* non-standard for webkit*/ 

/* Global values */
word-break: inherit;
word-break: initial;
word-break: unset;

The word-break property is specified as a single keyword chosen from the list of values below.

Values

normal
Use the default line break rule.
break-all
To prevent overflow, word breaks should be inserted between any two characters (excluding Chinese/Japanese/Korean text).
keep-all
Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.
break-word

Word-break:break-word ( non standard for webkit ) it works like word-wrap:break-word .

However when used with display: table or tables and layouts it works like word-break: break-all and make things working.

 

Formal syntax

normal| break-all| keep-all| break-word

Examples

HTML

<p>1. <code>word-break: normal</code></p>
<p class="normal narrow">This is a long and
 Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu
 次の単語グレートブリテンおよび北アイルランド連合王国で本当に大きな言葉</p>

<p>2. <code>word-break: break-all</code></p>
<p class="breakAll narrow">This is a long and
 Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu
 次の単語グレートブリテンおよび北アイルランド連合王国で本当に大きな言葉</p>

<p>3. <code>word-break: keep-all</code></p>
<p class="keepAll narrow">This is a long and
 Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu
 次の単語グレートブリテンおよび北アイルランド連合王国で本当に大きな言葉</p>
<p>4. <code>word-break: break-word</code></p>
<p class="wordbreak narrow">This is a long and
Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu
次の単語グレートブリテンおよび北アイルランド連合王国で本当に大きな言葉</p>

 

 

CSS

.narrow {
  padding: 5px;
  border: 1px solid;
  display: table;
  max-width: 100%;
}

.normal {
  word-break: normal;
}

.breakAll {
  word-break: break-all;
}

.wordbreak {
  word-break: break-word;
}

 

Specifications

Specification Status Comment
CSS Text Module Level 3
The definition of 'word-break' in that specification.
Working Draft Initial definition
Initial valuenormal
Applies toall elements
Inheritedyes
Mediavisual
Computed valueas specified
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 1Edge Full support 12Firefox Full support 15IE Full support 5.5
Notes
Full support 5.5
Notes
Notes No version of Internet Explorer supports the initial value.
Full support 8
Prefixed Notes
Prefixed Requires the vendor prefix: -ms-
Notes Don't use -ms-word-break, which is a synonym for word-break.
Opera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 15Opera Android No support NoSafari iOS ? Samsung Internet Android Full support Yes
keep-allChrome Full support 44Edge Full support YesFirefox Full support 15IE Full support 5.5Opera Full support 31Safari Full support 9WebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android Full support 15Opera Android No support NoSafari iOS Full support 9Samsung Internet Android Full support Yes
break-wordChrome Full support YesEdge Full support YesFirefox No support NoIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android No support NoOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Tag Dokumen dan Kontributor

Terakhir diperbarui oleh: vnkt66,