title: How to set a tooltip width dynamically?
body: <p>I want to create a tool-tip that will have flexible size according to the text length. For example, I have the following tool-tip:</p>
  
  <p><img src="https://i.stack.imgur.com/ZYV3n.png" alt="enter image description here"></p>
  
  <p>Now, for this text, the width is OK (fixed in the css). But, when I have a very smaller string: </p>
  
  <p><img src="https://i.stack.imgur.com/uW6Ux.png" alt="enter image description here"></p>
  
  <p>the tool-tip looks too big. My question is: how do I make the tool-tip flexible according to the text length? Is there a way to do this in the .css maybe? I work with d3.js, so an answer from this point of view would be acceptable too.</p>
  
  <p>Thank you in advance for your answer!</p>
  
  <p><strong><em>EDIT:</em></strong> I use <a href="http://www.d3noob.org/2013/01/adding-tooltips-to-d3js-graph.html" rel="nofollow noreferrer">this tutorial</a> in order to accomplish my goal,  my code is something like that (not exactly, but close enough). It would be best to provide an answer based on that example, since my code is too big to post here.</p>