title: Css add gradient to Element + Before
body: <p>I'm drawing a tooltip box with Css.
  Now I would like to apply a gradient to the whole box including the triangle. But the gradient is always only applied to the box.</p>
  
  <p>I tried to put the gradient into the after element, but that doesnt work either. I would just color the triangle in one color, but I need to be able to move it to other places too.</p>
  
  <p>This isn't a duplicate question, as in other answers, the triangle is just colored in the end color of the gradient. But I would like the gradient to also apply to the triangle.</p>
  
  <p><a href="https://i.stack.imgur.com/FKLDv.png" rel="nofollow"><img src="https://i.stack.imgur.com/FKLDv.png" alt="enter image description here"></a></p>
  
  <p>Here's an example:</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>body {
    background-color: tomato;
  }
  #bubble {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 154px;
    height: 140px;
    padding: 0px;
    background: #FFFFFF;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
    text-align: center;
    font-size: 1em;
    font-weight: 500;
    background: -webkit-linear-gradient(rgba(223, 204, 206, 0.9) 0%, rgba(242, 144, 127, 1) 100%);
    background: -o-linear-gradient(rgba(223, 204, 206, 0.9) 0%, rgba(242, 144, 127, 1) 100%);
    background: linear-gradient(rgba(223, 204, 206, 0.9) 0%, rgba(242, 144, 127, 1) 100%);
    / filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#e6dfccce', endColorstr='#f2907f', GradientType=0);
  }
  #bubble:after {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 15px 16px 0px;
    border-color: #FFFFFF transparent;
    display: block;
    width: 0;
    z-index: 1;
    bottom: -15px;
    left: 59px;
  }
  #bubble &gt; :first-child {
    margin-top: 19px;
  }
  .answerWrapper {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  .answerWrapperText {
    width: 40px;
    height: 38px;
    color: #131313;
    border: solid 2px #131313;
  }
  .answerWrapper &gt; :first-child {
    margin: 0 0 0 18px;
  }
  .answerWrapper &gt; :nth-child(2) {
    margin: 0 18px 0 0;
  }
  .answerWrapperText p {
    margin: 0;
    margin-top: 9px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="bubble"&gt;
    &lt;p&gt;Have you
      &lt;br&gt;chosen wisely&amp;#8239;?&lt;/p&gt;
    &lt;div class="answerWrapper"&gt;
      &lt;div class="answerWrapperText"&gt;
        &lt;p id="yes"&gt;yes&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="answerWrapperText"&gt;
        &lt;p id="no"&gt;no&lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>