word-break


Это свойство не работает в браузере Opera.



значения свойства:


  • normal
  • break-all
  • hyphenate



css/style.css
  • div {
  •  width: 300px;
  •  height: 70px;
  •  border: 1px solid #8E8E8E;
  • }
  •  
  • .a {
  •  word-break: normal;
  • }
  •  
  • .c {
  •  white-space: pre;
  • }
div {
 width: 300px;
 height: 70px;
 border: 1px solid #8E8E8E;
}

.a {
 word-break: normal;
}

.c {
 white-space: pre;
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div class="a">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  •  <br />
  •  <div id="div1">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  •  <br />
  •  <div class="b">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div1").style.wordBreak = "break-all";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "word-break": "hyphenate" });
  •  });
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div class="a">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  •  <br />
  •  <div id="div1">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  •  <br />
  •  <div class="b">
  •   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  •  </div>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("div1").style.wordBreak = "break-all";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "word-break": "hyphenate" });
  •  });
  • </script>
  • </body>
  • </html>