title: Define a width for each words and compose a title automatically
body: <p>I’m searching for a way of automatically 
  compose a sentence using javascript.<br><br>
  Here is an example using this sentence : <br>
  <strong>«here is an amazing sentence well composed»</strong>
  <a href="https://i.stack.imgur.com/Seal4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Seal4.png" alt="enter image description here"></a>
  Then I’d like the block size to change dependind 
  on the word width<br><a href="https://i.stack.imgur.com/fVEyo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fVEyo.png" alt="Different sizes"></a>
  So that finally, it could look like this :<a href="https://i.stack.imgur.com/dnnL3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dnnL3.png" alt="Final result"></a>
  So far, I only found how to cut the sentences in words.<br>
  How could I define a width for each «words / text block»
  depending on their width ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function wordsinblocks() {
      var str = document.getElementById("demo").innerHTML;
      var res = str.split(" ");
      document.getElementById("demo").innerHTML = res; 
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code> body{
      font-family:"helvetica";
      font-size: 40px;
      }
  p {border: 1px solid black;}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="wordsinblocks();"&gt;Design the sentence&lt;/button&gt;
  &lt;p id="demo"&gt;Here is an amazing sentence well composed&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>