zoukankan      html  css  js  c++  java
  • 连字符 | hyphens (Text)

  •   CSS 中文开发手册

    连字符 | hyphens (Text) - CSS 中文开发手册

    该hyphens CSS属性指定当文字跨越多行时如何自动换行断字。您可以完全禁止连字符,在文本中手动指定点来使用连字符,或者让浏览器在适当的地方自动插入连字符。

    /* Keyword values */
    hyphens: none;
    hyphens: manual;
    hyphens: auto;
    
    /* Global values */
    hyphens: inherit;
    hyphens: initial;
    hyphens: unset;

    连字规则是依语言而定的。在HTML中,语言是由lang属性决定的,只有当这个属性存在时且有合适的连字符字典可用时,浏览器才会使用连字符。在XML中,要求必须使用xml:lang属性。

    注意:定义如何执行连字符的规则没有被规范明确定义,所以确切的连字符规则可能因浏览器而异。

    Initial value

    manual

    Applies to

    all elements

    Inherited

    yes

    Media

    visual

    Computed value

    as specified

    Animation type

    discrete

    Canonical order

    the unique non-ambiguous order defined by the formal grammar

    语法

    该hyphens属性被指定为从下面的列表中选择出的单个关键字。

    可能值

    none——即使文字中的字符表示换行符,文字也不会在换行符处断开。行将只包含在空白处。

    manual——只有在单词内部的字符表示换行的情况下,单词才会被断开。有关详细信息,请参阅下面的建建议的换行时机。

    auto——只要遵循它所选择使用的任何规则,浏览器就可以自由地在合适的连字点处自动分词。但是,建议的换行时机(请参阅下面的建议换行时机)将覆盖自动断点选择。

    注:该auto设置的行为取决于语言被正确标记,以便可以选择相应的断字规则。您必须使用lang这个HTML属性指定一种语言,以确保自动连字符应用于您所选择的语言。

    建议换行时机

    有两个Unicode字符可用于在文本中手动指定潜在的换行点:

    U + 2010(HYPHEN):该“硬”连字符表示可见的换行时机。即使该行实际上没有被断开,连字符仍然呈现。

    U + 00AD(SHY):一个不可见的“软”连字符。这个字符不是可见的,它只是标志着浏览器应该断行的位置。在HTML中,您可以使用­插入一个软连字符。

    形式语法

    none | manual | auto

    实例

    这个例子使用三个类,其中一个用于hyphens属性的每个可能的配置。

    HTML

    <ul>
      <li><code>none</code>: no hyphen; overflow if needed
        <p lang="en" class="none">An extreme­ly long English word</p>
      </li>  
      <li><code>manual</code>: hyphen only at &hyphen; or &shy; (if needed)
        <p lang="en" class="manual">An extreme­ly long English word</p>
      </li>
      <li><code>auto</code>: hyphen where the algorithm is deciding (if needed)
        <p lang="en" class="auto">An extreme­ly long English word</p>
      </li>
    </ul>

    CSS

    p { 
       55px;
      border: 1px solid black;
     }
    p.none {
      -webkit-hyphens: none;
      -ms-hyphens: none;
      hyphens: none;
    }
    p.manual {
      -webkit-hyphens: manual;
      -ms-hyphens: manual;
      hyphens: manual;
    }
    p.auto {
      -webkit-hyphens: auto;
      -ms-hyphens: auto;
      hyphens: auto;
    }

    结果

    规范

    Specification

    Status

    Comment

    CSS Text Module Level 3The definition of 'hyphens' in that specification.

    Working Draft

    Initial definition

    浏览器兼容性

    Feature

    Chrome

    Firefox (Gecko)

    Internet Explorer

    Opera

    Safari

    Basic support

    13.0-webkit1 55.0 (unprefixed)

    6.0 (6.0)-moz2 43.0 (43.0)

    10.0-ms3

    44

    5.1-webkit

    Hyphenation dictionary for Afrikaans (af, af-*)

    ?

    8.0 (8.0)

    No support

    ?

    No support

    Hyphenation dictionary for Bulgarian (bg, bg-*)

    ?

    8.0 (8.0)

    No support

    ?

    No support

    Hyphenation dictionary for Catalan (ca, ca-*)

    ?

    8.0 (8.0)

    10.0

    ?

    9.1

    Hyphenation dictionary for Croatian (hr, hr-*)

    ?

    8.0 (8.0)

    No support

    ?

    9.1

    Hyphenation dictionary for Czech (cs, cs-*)

    ?

    No support

    10.0

    ?

    9.1

    Hyphenation dictionary for Danish (da, da-*)

    ?

    8.0 (8.0)

    10.0

    ?

    9.1

    Hyphenation dictionary for Dutch (nl, nl-*)

    ?

    8.0 (8.0)

    10.0

    ?

    5.1

    Hyphenation dictionary for English (en, en-*)

    55.0 (unprefixed)

    6.0 (6.0)4

    10.0

    44

    5.15

    Hyphenation dictionary for Esperanto (eo, eo-*)

    ?

    8.0 (8.0)

    No support

    ?

    No support

    Hyphenation dictionary for Estonian (et, et-*)

    ?

    8.0 (8.0)

    No support

    ?

    No support

    Hyphenation dictionary for Finnish (fi, fi-*)

    ?

    8.0 (8.0)

    No support

    ?

    9.1

    Hyphenation dictionary for French (fr, fr-*)

    ?

    8.0 (8.0)

    10.0

    ?

    5.1

    Hyphenation dictionary for Galician (gl, gl-*)

    ?

    9.0

    No support

    ?

    No support

    Hyphenation dictionary for German, Traditional Orthography of 1901 (de-1901, de-AT-1901, de-DE-1901)

    ?

    8.0

    ?

    ?

    ?

    Hyphenation dictionary for German, Reformed Orthography of 1996 (de, de-1996, de-DE, de-AT, de-*)

    ?

    8.0

    10.0

    ?

    5.1

    Hyphenation dictionary for German, Swiss Orthography (de-CH, de-CH-*)

    ?

    8.0

    ?

    ?

    ?

    Hyphenation dictionary for Hungarian (hu, hu-*)

    ?

    9.0

    No support

    ?

    9.1

    Hyphenation dictionary for Icelandic (is, is-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Interlingua (ia, ia-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Italian (it, it-*)

    ?

    9.0

    10.0

    ?

    5.1

    Hyphenation dictionary for Kurmanji (kmr, kmr-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Latin (la, la-*)

    (Yes)

    8.0

    No support

    44

    No support

    Hyphenation dictionary for Lithuanian (lt, lt-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Mongolian (mn, mn-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Norwegian (Bokmål) (no, no-*, nb, nb-*)

    ?

    8.0

    10.0

    ?

    9.1

    Hyphenation dictionary for Norwegian (Nynorsk) (nn, nn-*)

    ?

    8.0

    10.0

    ?

    No support

    Hyphenation dictionary for Polish (pl, pl-*)

    ?

    31.0

    10.0

    ?

    9.1

    Hyphenation dictionary for Portuguese (pt, pt-*)

    ?

    8.06

    10.0

    ?

    9.1

    Hyphenation dictionary for Brazilian Portuguese (pt-BR)

    ?

    8.06

    10.0

    ?

    No support

    Hyphenation dictionary for Russian (ru, ru-*)

    ?

    8.0

    10.0

    ?

    5.1

    Hyphenation dictionary for Serbian, Bosnian, Serbo-Croatian (sh, sh-*, sr, sr-*, bs, bs-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Slovenian (sl, sl-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Spanish (es, es-*)

    ?

    8.0

    10.0

    ?

    5.1

    Hyphenation dictionary for Swedish (sv, sv-*)

    ?

    8.0

    10.0

    ?

    9.1

    Hyphenation dictionary for Turkish (tr, tr-*)

    ?

    9.0

    10.0

    ?

    9.1

    Hyphenation dictionary for Ukrainian (uk, uk-*)

    ?

    9.0

    No support

    ?

    9.1

    Hyphenation dictionary for Upper Sorbian (hsb, hsb-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for Welsh (cy, cy-*)

    ?

    8.0

    No support

    ?

    No support

    Hyphenation dictionary for other languages

    ?

    No support

    No support

    ?

    No support

    Feature

    Android

    Android Webview

    Firefox Mobile (Gecko)

    IE Mobile

    Opera Mobile

    Safari Mobile

    Chrome for Android

    Basic support

    4.0-webkit1

    55.0 (unprefixed)

    6.0 (6.0)-moz2 43.0 (43.0)

    No support

    44

    4.2-webkit

    55.0 (unprefixed)

    Hyphenation dictionary for Afrikaans (af, af-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Bulgarian (bg, bg-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Catalan (ca, ca-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Croatian (hr, hr-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Czech (cs, cs-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Danish (da, da-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Dutch (nl, nl-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for English (en, en-*)

    ?

    55.0 (unprefixed)

    ?

    ?

    44

    ?

    55.0 (unprefixed)

    Hyphenation dictionary for Esperanto (eo, eo-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Estonian (et, et-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Finnish (fi, fi-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for French (fr, fr-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Galician (gl, gl-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for German, Traditional Orthography of 1901 (de-1901, de-AT-1901, de-DE-1901)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for German, Reformed Orthography of 1996 (de, de-1996, de-DE, de-AT, de-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for German, Swiss Orthography (de-CH, de-CH-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Hungarian (hu, hu-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Icelandic (is, is-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Interlingua (ia, ia-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Italian (it, it-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Kurmanji (kmr, kmr-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Latin (la, la-*)

    ?

    (Yes)

    ?

    ?

    44

    ?

    (Yes)

    Hyphenation dictionary for Lithuanian (lt, lt-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Mongolian (mn, mn-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Norwegian (Bokmål) (no, no-*, nb, nb-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Norwegian (Nynorsk) (nn, nn-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Polish (pl, pl-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Portuguese (pt, pt-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Brazilian Portuguese (pt-BR)

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Russian (ru, ru-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Serbian, Bosnian, Serbo-Croatian (sh, sh-*, sr, sr-*, bs, bs-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Slovenian (sl, sl-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Spanish (es, es-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Swedish (sv, sv-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Turkish (tr, tr-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Ukrainian (uk, uk-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Upper Sorbian (hsb, hsb-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for Welsh (cy, cy-*)

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    Hyphenation dictionary for other languages

    ?

    ?

    ?

    ?

    ?

    ?

    ?

  •   CSS 中文开发手册
    转载请保留页面地址:https://www.breakyizhan.com/css/32419.html
  • 相关阅读:
    JavaScript+IndexedDB实现留言板:客户端存储数据
    怎么限制Google自动调整字体大小
    《互联网时代》告诉我的互联网简史(二)
    《互联网时代》告诉我的互联网简史(一)
    CSS换行:word-wrap、word-break和text-wrap区别
    php中的字符串和正则表达式
    php数组使用小结
    问题:关于一个贴友的js留言板的实现
    问题:关于坛友的一个定时重复显示和隐藏div的实现
    使用union 外加count
  • 原文地址:https://www.cnblogs.com/breakyizhan/p/13234049.html
Copyright © 2011-2022 走看看