title: Keep tooltip within parent container?
body: <p>I cannot figure out a way to keep the tooltip inside the "main-content" container. Here's the 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>.main-content {
    background: #151418;
    width: 500px;
    min-height: 200px;
  }
  [data-tooltip] {
    display: inline;
    position: relative;
    cursor: pointer;
  }
  [data-tooltip]:hover:after {
    background: rgba(0, 0, 0, .9);
    border-left: 5px solid #000;
    border-right: 5px solid #000;
    border-radius: 5px;
    position: absolute;
    bottom: 16px;
    left: 0;
    content: attr(data-tooltip);
    font-family: Consolas, "courier new";
    font-size: 12px;
    color: #657b99;
    padding: 5px 10px;
    z-index: 98;
    white-space: nowrap;
  }
  p {
    color: white;
    margin-left: 50px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main-content"&gt;
    &lt;br&gt;
    &lt;br&gt;
    &lt;p&gt;Hover mouse &lt;span data-tooltip="Here goes a long text that does not stay inside main-content container"&gt;HERE&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there any way to push it back inside?</p>
  
  <p>Or add an max-width to the tooltip somehow? I tried to add max-width, but it didn't work because of <code>[data-tooltip]</code>'s <code>display:inline;</code>.</p>
  
  <p>(I know that replacing "inline" with "block" would solve the problem with max-width, but I can't do that because I need to keep the text inline...)</p>