title: How to make tooltip stretch to fit text (without pre-defined width)
body: <p>So, I have a tooltip and I want it to stretch to fit all of the text inside of it. I have about 30 tooltips actually and I don't want to manually change them (I tried it and it didn't work so I'm not sure how I would anyway). Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.programButton {
      width: 1000px;
      height: 100px;
      background: #EAEAEA;
      border: 1px solid black;
      text-align: left;
  }
  #programButtonText, .programButtonExtra {
      font-family: 'Open Sans', sans-serif;
      font-size: 34px;
      margin-left: 8px;
  }
  .extraBox {
      width: 180px;
      background: white;
      border: 2px solid #999999;
      top: -55px;
      left: 380px;
      margin-bottom: -92px;
      /*margin-top: -80px;
      margin-left: 1000px;*/
      position: relative;
      display: block;
  }
  .extraBox1 {
      font-family: 'Open Sans', sans-serif;
      font-size: 25px;
      color: #47BC47;
      background: white;
      margin: 5px;
      margin-bottom: 10px;
  }
  .extraBox1:hover {
      cursor: pointer;
      background: #47BC47;
      color: white;
  }
  .extraBox2:hover {
      cursor: pointer;
      background: #D41B1B;
      color: white;
  }
  .extraBox2 {
      font-family: 'Open Sans', sans-serif;
      font-size: 25px;
      color: #D41B1B;
      background: white;
      margin: 5px;
      margin-top: 0px;
  }
  #programButtonText {
      line-height: 65px;
  }
  .hoverText {
      cursor: pointer;
  }
  .lastVisited {
      font-family: 'Open Sans', sans-serif;
      font-size: 22px;
      margin-top: -35px;
      margin-left: -793px;
  }
  .entireProgramButton {
      display: block;
      cursor: default;
  }
  .programButtonExtra {
      margin-top: -41px;
      margin-left: 980px;
  }
  span.tooltips {
    position: relative;
    display: inline;
  }
  span.tooltips span {
    font-family: 'Open Sans', sans-serif;
    font-size: 22px;
    position: absolute;
    color: #FFFFFF;
    background: #000000;
    height: 40px;
    line-height: 40px;
    text-align: center;
    display: none;
    visibility: hidden;
    border-radius: 9px;
  }
  span.tooltips span:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0; height: 0;
    border-top: 8px solid #000000;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
  }
  span:hover.tooltips span {
    visibility: visible;
    display: block;
    opacity: 1;
    bottom: 30px;
    right: -378px;
    top: -35px;
    margin-left: -76px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;center&gt;
      &lt;div id = "entireProgramButton9" class = "entireProgramButton"&gt;
          &lt;div id = "programButton9" class = "programButton"&gt;&lt;div id = "programButtonText"&gt;&lt;span id = "programName9" class = "hoverText"&gt;Tic-Tac-Toe&amp;nbsp;&lt;span class = "tooltips" id = "information"&gt;ⓘ&lt;span&gt;The Tic-Tac-Toe game lets you play against AI or another player.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class = "programButtonExtra" id = "programButtonExtra9"&gt;&lt;span class = "hoverText"&gt;⋮&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class = "lastVisited"&gt;Last visited: Never&lt;/div&gt;
          &lt;div class = "extraBox" id = "extraBox9"&gt;
              &lt;div id = "extraBox19" class = "extraBox1"&gt;Save for later&lt;/div&gt;
              &lt;div id = "extraBox29" class = "extraBox2"&gt;Report a bug&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/center&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So, as you can see (best results on the full-page results), when you hover over the ⓘ, it shows a little tooltip telling you about it. This works, but you'll notice that there is a lot of blank space on both sides of the text. This is because when I was making it, that <code>800px</code> of <code>width</code> worked on the tooltip. Since I have like 30 tooltips, how can I have it so that it stretches the width approximately to fit the text?</p>
  
  <p><strong>Edit:</strong> It turns out that on this specific box, the tooltip does not look bad (besides the moving) if you take out the width. I replaced the program with another that I would have.</p>
  
  <p>I also took out the width to show you what happens without it.</p>