9

Is it possible to define the language used for -webkit-hyphens:auto? Does it default to the system language?

<p style="-webkit-hyphens:auto" lang="en">
Hyphenated in English
</p>
<p style="-webkit-hyphens:auto" lang="es">
Hyphenated en Español
</p>

According to the Mozilla documentation the hyphens property will use the language specified in the lang HTML attribute. However, I can't find any mention of the -webkit-hyphens property in the Safari documentation.

Additionally, does the meta language attribute have any effect? Or can this be applied applied to the html element?

Here's the fiddle I'm using for testing (in Safari and Firefox).

hpique
  • 119,096
  • 131
  • 338
  • 476
  • This article was extremely enlightening: http://code.google.com/p/hyphenator/wiki/en_CSS3Hyphenation – hpique Oct 27 '11 at 08:53

1 Answers1

9

Is it possible to define the language used for -webkit-hyphens:auto?

Yes.

However, I can't find any mention of the -webkit-hyphens property in the Safari documentation.

According to the webkit changelog, it does allow the language to be specified.

https://bugs.webkit.org/show_bug.cgi?id=43467

You may need to use -webkit-hyphenate-locale to get it to work.

Or can this be applied applied to the html element?

According to this post and its examples, you can set the lang attribute right in the element.

http://drublic.de/blog/css3-auto-hyphenation-for-text-elements/

Jason Gennaro
  • 34,535
  • 8
  • 65
  • 86
  • Safari does recognize the lang element. iOS Safari (at least on the simulator) does not. In that case I used -webkit-locale not -webkit-hyphenate-locale. – hpique Oct 27 '11 at 08:54
  • is possible **hyphens** over any string and not limited to X language ? – Stackoverflow Jun 08 '21 at 01:03