css-secrets

20. 连字符断行

<!DOCTYPE html>
<html>
<head>
  <style>
    .container {
      width: 220px;
      font: 180%/1.4 Baskerville, serif;
      text-align: justify;
      hyphens: auto;
      -webkit-hyphens: auto;
      -moz-hyphens: auto;
    }
  </style>
</head>
<body>
<div class="container">
  The only way to get rid of a temptation is to yield to it
</div>
</body>
</html> 

貌似目前(2018.07.17)只有 safari 支持?可是 caniuse 显示 chrome 和 ff 也支持,但是试了下好像不支持,包括书中的 demo http://play.csssecrets.io/hyphenation