I just came across a neat CSS trick:
HTML:
<div>Cool Trick:<br />
<div class="tooltiptail"></div>
</div>
<br />
<div>How do I get this effect with only CSS?<br />
<div class="anothertail"></div>
</div>
CSS:
.tooltiptail {
display: block;
border-color: #ffffff #a0c7ff #ffffff #ffffff;
border-style: solid;
border-width: 20px;
width: 0px;
height: 0px;
}
.anothertail {
background-image: url(http://static.jqueryfordesigners.com/demo/images/coda/bubble-tail2.png);
display: block;
height: 29px;
width: 30px;
}
Check out the fiddle... http://jsfiddle.net/duZAx/1/
This creates a little arrow/triangle-like effect, a "tooltip tail". This blows my mind! I'm really interested in knowing how this works?!
Further, is there a way to extend this CSS trick to create an effect as follows...
This is an interesting problem.
- Can this be done using only CSS, without the shadow?
- Can this be done with the shadow and having it cross-browser compatible?
box-shadow
is enough for my case. Also, if I really wanted to make it look like the image itself, I can use another element, make it like 1px by 1px, and give it a bigger box shadow and spread it out to make it look like a circle :) – Fransen