Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a <a href="http://jsfiddle.net/mezis/abKFz/9/" rel="nofollow">complete working example</a> in full (S)CSS, with variables for nose size shadow width and an optional border.</p> <p>The trick is to get the offsets and transform right to achieve pixel-perfection, and to use <code>overflow:hidden</code> as necessary to cut the nose of your bubble (especially if you need borders).</p> <p>The example in the answer above doesn't work for us because the shadow gets cropped and is laid over the main bubble area.</p> <p>Degrades gracefully in IE7/8.</p> <p>HTML:</p> <pre><code>&lt;div class="chat"&gt; &lt;div class="bubble"&gt; &lt;span class='tail'&gt;&amp;nbsp;&lt;/span&gt; &lt;p&gt;The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children.&lt;/p&gt;&lt;p&gt;And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>SCSS:</p> <pre><code>$shadow_radius = 6px; $nose_size = 12px; $shadow = 0 1px $shadow_radius #B2B2B2; $border = 1px solid #bbb .chat { font-family: sans-serif; font-size: small; } .bubble { background-color: #F2F2F2; border-radius: 5px; border: $border; box-shadow: $shadow; display: inline-block; padding: 10px 18px; margin-left: ($shadow_radius + $nose_size); margin-right: ($shadow_radius + $nose_size); position: relative; vertical-align: top; } .tail { position: absolute; top: $nose_size; left: -($shadow_radius + $nose_size); height: ($shadow_radius + $nose_size); width: ($shadow_radius + $nose_size); overflow: hidden; } .tail:before { border: $border; background-color: #F2F2F2; box-shadow: $shadow; content: "\00a0"; display: block; position: absolute; top: 0px; left: $nose_size; height: $nose_size; width: $nose_size; -webkit-transform: skew( -45deg ); -moz-transform: skew( -45deg ); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload