title: Speech bubble with arrow
body: <p>I have a project where I need to insert <strong>speech bubbles / message boxes</strong>. The general shape I am trying to achieve is this one :</p>
  <p><img src="https://i.stack.imgur.com/4p76y.png" alt="CSS speech bubble with arrow or triangle" /></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-css lang-css prettyprint-override"><code>.bubble {
    height: 100px;
    width: 200px;
    border: 3px solid gray;
    background: lightgray;
    position: relative;
    cursor:pointer;
  }
  .triangle {
    width: 0;
    border-top: 20px solid black;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    cursor:pointer;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="bubble"&gt;Speech bubble
  &lt;/div&gt;
  &lt;div class="triangle"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>This currently does not pass a hit-test as the transparent border is also clickable.</p>
  <p><strong>Objectives</strong></p>
  <ul>
  <li><p>The hit box (clickable / hoverable areas) needs to stick to the shape's boundaries (the transparent borders here are also hoverable, invalidating this).</p>
  </li>
  <li><p>I need to display the shape over various content (images, gradents, text...),</p>
  </li>
  </ul>
  <p><strong>Issues</strong></p>
  <p>The main issues I am having when manipulating this shape are:</p>
  <ul>
  <li>Have the ability to <strong>move the triangle around the speech bubble</strong> according to the position of the element it refers to (top/left/right/bottom sides)</li>
  <li>adding a border or box shadow around it when emphasis is needed</li>
  </ul>
  <p>Is there anyway of addressing these issues?</p>