JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<p class="p" id="p">supercalifragilisticexpialidocious</p>

<button id="b" data-ww="break-word">切换word-wrap方式</button>


<script>var p = document.getElementById('p'),
    b = document.getElementById('b');

b.onclick = function () {
  if (this.getAttribute('data-ww') === 'break-word') {
    p.style.wordWrap = 'normal';
    this.setAttribute('data-ww', 'normal');
  } else {
    p.style.wordWrap = 'break-word';
    this.setAttribute('data-ww', 'break-word');
  }
};//@ sourceURL=pen.js
</script>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk

 Served from: www.webhek.com @ 2015-02-02 09:10:15 by W3 Total Cache --></body>

CSS

body {
  font-family: Arial, sans-serif;
  text-align: center;
}

.p {
  font-size: 24px;
  text-align: center;
  width: 200px;
  margin: 20px auto;
  border: solid 1px black;
  min-height: 60px;
  word-wrap: break-word;
}

button {
  display: block;
  margin: 0 auto;
}