CSS3 hyphens not applied

784 views Asked by At

I'm trying to add automatic CSS3 hyphens to my articles. Problem is the tag doesn't seem to affect the text.

I set

.entry p {
  -webkit-hyphens: auto;
     -moz-hyphens: auto;
          hyphens: auto;
}

... but nothing happens.

Here's an example page I'm talking about (BTW you won't see the above CSS in real site, but I tried with Firebug).

2

There are 2 answers

0
randak On BEST ANSWER

The issue in this case is a missing lang attribute. Without that defined, the web browsers do no know how to hyphenate the page, because they don't know what language they are hyphenating in.

Adding this attribute will fix the issue in browsers that support hyphenation.

4
DOK On

You didn't mention which browser you are using.

According to this article, Chrome and Android browser actually support -webkit-hyphens: none, which is the default value, but none of the other values.

And, in Firefox and Internet Explorer, automatic hyphenation only works for some languages (defined with the lang attribute).

Edit: Here is the Mozilla page, which says "This is an experimental technology".