Randomblue Randomblue - 1 year ago 230
CSS Question

CSS tooltip tail with image

Tooltip tails in CSS are possible, see for example here. I am looking to do similar CSS tooltip tails, but with a background image. See for example Twitter's card tooltip (look in the top-left corner):

enter image description here

How can I do image tooltip tails?

Answer Source

The easiest way to do it using SVG and clip-path (just like twitter did)

Here's Fiddle Demo

It uses an img element and then it's masked. You can create the element using an online tool or free svg editor like InkScape


  -webkit-clip-path: polygon(58px 25px,70px 9px,81px 25px,380px 25px,380px 215px,11px 215px,10px 25px);

  clip-path: url("#clipPolygon");


<svg width="0" height="0">
  <clipPath id="clipPolygon">
    <polygon points="56 25,70 9,81 25,380 25,380 215,11 215,10 25">

<img class="tooltip" src="http://lorempixel.com/image_output/animals-q-c-640-480-3.jpg" alt="">


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download