Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Crossbrowser approach:</strong> </p> <p><div class="snippet" data-lang="js" data-hide="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.tooltip { position:relative; padding:10px; border-bottom:1px solid #000; background:#ccc; } .arrow { background:transparent; display:inline-block; position:absolute; bottom:-20px; border-left:10px solid transparent; border-bottom:10px solid transparent; border-top:10px solid #000; border-right:10px solid transparent; } .arrow i { display:inline-block; position:absolute; top:-10px; left:-9px; width:0; height:0; border-left:9px solid transparent; border-bottom:9px solid transparent; border-top:9px solid #ccc; border-right:9px solid transparent; } * html .arrow { border-bottom-color:white; border-left-color:white; border-right-color:white; filter: chroma(color=white); } * html .arrow i { border-bottom-color:white; border-left-color:white; border-right-color:white; filter: chroma(color=white); }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="tooltip"&gt; &lt;span class="arrow"&gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt; Tooltip text that wants to be your friend. &lt;/div&gt;</code></pre> </div> </div> </p> <p>This one works from IE7+ (works in IE6 using (<code>filter: chroma(color=white);</code>) too but won't display the black border around the arrow).</p> <p><strong>IE6 fix:</strong></p> <pre class="lang-css prettyprint-override"><code>* html .arrow { border-bottom-color:white; border-left-color:white; border-right-color:white; filter: chroma(color=white); } * html .arrow i { border-bottom-color:white; border-left-color:white; border-right-color:white; filter: chroma(color=white); } </code></pre> <p>This will make the ugly black transparecy that is rendered by IE6 the color you specified in chroma filter (I did white so it disappears in background).</p> <p><hr /> <strong>CSS 3 approach:</strong></p> <p>You could do it with CSS3 rotation, but will fail in non CSS3 compliant browsers:</p> <pre class="lang-css prettyprint-override"><code>.tooltip { position:relative; padding:10px; background:#ccc; border-bottom:1px solid #000; } .tooltip:before { content:""; display:block; width:10px; height:10px; position:absolute; bottom:-6px; border-left:1px solid #000; border-bottom:1px solid #000; background:#ccc; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); transform: rotate(-45deg); } </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;div class="tooltip"&gt; Tooltip text that wants to be your friend. &lt;/div&gt; </code></pre>
 

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