문제

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).

도움이 되었습니까?

해결책

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.

다른 팁

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".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top