Hướng dẫn css hyphens not working
Show I'm currently working on a web page, I have this tag in which I want to apply hyphenation, I used multiple combinations of attributes in CSS
this combination works perfectly in Firefox and Safari in both desktop and mobile versions, but I cannot get it to work in chrome, I have also tried other combination with word-break, word-wrap and overflow-wrap but the problem is still there. I have also read that it is a chrome bug but according to the last information from https://caniuse.com/?search=hyphens, it states that there is partial support with the auto value. Here is the example I'm using: this is the text breaking properly on Safari and firefox this what I get when I open the page on chrome (both desktop and mobile) the Hyphenation works properly in chrome only when the header contains at least 3 words. and this what I get when I only use two words in chrome, it causes an overflow and does not break, but it breaks correctly in firefox and safari I'm using chrome on a mac with version 87.0.4280.88 which is currently the latest and android chrome version 87.0.4280.101 I would be thankful for any help. asked Dec 29, 2020 at 12:42
1 This looks like crbug.com/1022415, which was fixed in Chrome 89. It works as expected when I tried in my local test. For your snippet, you need to add the
answered Apr 21, 2021 at 19:32
1 Chrome does not support hyphens: auto; (as on 2021-01-12) only FireFox, Edge classic do this. answered Jan 12, 2021 at 14:27
theking2theking2 1,6281 gold badge22 silver badges28 bronze badges 2 The Note: In the above demo, the string "An extraordinarily long English word!" contains the hidden Hyphenation rules are language-specific. In HTML, the language is determined by the
Note: The rules defining how hyphenation is performed are not explicitly defined by the
specification, so the exact hyphenation may vary from browser to browser. If supported, The Values
Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace. manual Words are broken for line-wrapping only where characters inside the word suggest line break opportunities. See Suggesting line break opportunities below for details. auto
The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses. However, suggested line break opportunities (see Suggesting line break opportunities below) will override automatic break point selection when present. Note: The Suggesting line break opportunitiesThere are two Unicode characters used to manually specify potential line break points within text: U+2010 (HYPHEN)The "hard" hyphen character indicates a visible line break opportunity. Even if the line is not actually broken at that point, the hyphen is still rendered. U+00AD (SHY)An invisible, "soft" hyphen. This character is not rendered visibly; instead, it marks a place where the browser should break the word if hyphenation is necessary. In HTML, use Note: When the HTML Formal definitionFormal syntaxhyphens = ExamplesSpecifying text hyphenationThis example uses three classes, one for each possible configuration of the HTML
CSS
ResultSpecifications
Browser compatibilityBCD tables only load in the browser See also |