Tooltip Styles Inspiration

A small collection of various hover tooltip styles and effects for your inspiration. Using CSS transforms, border-radius and SVG shapes we can create modern looking and interesting tooltips.

TooltipStylesInspiration

View demo Download source

Today we’d like to share some tooltip styles and effects with you. Tooltips are normally used for providing some kind of extra information and they can be found in almost every website. Those tiny little helpers offer a great opportunity to add some subtle and unique effects to any design. So today we want to show you some possibilities of showing those elements in style.

We only use CSS transitions via hover and also some SVGs to create unique shapes. Icons are from Font Awesome and the profile pictures are from the Random User Generator.

Please note that we use some modern CSS properties, like 3D transforms, which only work in modern browsers.

There seems to be an issue with using a percentage-based transform-origin value for SVG paths in Firefox. You might not be able to see the correct transform effect, so we recommend using Google Chrome to see all the examples working correctly.

Also note that animating the stroke-dasharray does not work in the IE < 11.

The examples are CSS-only using hover to show the tootlips, which is not a mobile solution. You would want to use some JavaScript for controlling the appearance on click, rather than hover in that case. A full-blown solution would also take the positioning of the tooltip into account so that they don’t appear off-screen. Some useful solutions are the following:

Let’s have a look at the “sharp” tooltip style. The markup is as follows:

<blockquote>
	<p>A man of my <span class="tooltip tooltip-turnright"><span class="tooltip-item">spiritual</span><span class="tooltip-content"><strong>[spir·it·u·al]</strong> affecting the human spirit or soul as opposed to material or physical things</span></span> intensity does not eat <span class="tooltip tooltip-turnleft"><span class="tooltip-item">corpses</span><span class="tooltip-content"><strong>[corpse]</strong> dead body, body, carcass, skeleton, remains, mortal remains, rotten bacon</span></span>.</p>
	<footer><span class="tooltip tooltip-turnright"><span class="tooltip-item">George Bernard Shaw</span><span class="tooltip-content"><strong>George Bernard Shaw</strong> (26 July 1856 – 2 November 1950) was an Irish playwright and a co-founder of the London School of Economics.</span></span></footer>
</blockquote>	

We have two tooltip variations: the one that turns the tip to the left and the one that has it turned to the right. For this example we will be using an SVG shape for the tip.

TooltipStylesInspiration01

So, let’s have a look at the CSS:

@import url(http://fonts.googleapis.com/css?family=Kalam:700,400);

.tooltip {
	position: relative;
	z-index: 999;
}

This is our trigger text:

.tooltip-item {
	font-weight: bold;
	cursor: pointer;
}

The content of the tooltip will have a matching border radius that fits with the sharp tip. We’ll position it absolutely right above the trigger item and then adjust the position with margins. While the width is fixed, the height will increase as needed. Initially, we’ll set it to be transparent.

.tooltip-content {
	position: absolute;
	bottom: 100%;
	left: 50%;
	z-index: 9999;
	margin: 0 0 105px -140px;
	padding: 25px;
	width: 280px;
	border-radius: 10px/50%;
	background: #fff;
	color: #dd5864;
	text-align: left;
	font-size: 16px;
	opacity: 0;
	cursor: default;
	transition: opacity 0.3s, transform 0.3s;
	pointer-events: none;
}

Depending on the turn of the tip, we’ll set the according rotation of the content. We basically want the content to rotate along with the tip, creating an “opening” effect.

.tooltip-turnright .tooltip-content {
	transform: translate3d(0,50px,0) rotate3d(1,1,1,6deg);
}

.tooltip-turnleft .tooltip-content {
	transform: translate3d(0,50px,0) rotate3d(1,1,1,-6deg);
}

On hover, we show the content:

.tooltip:hover .tooltip-content {
	opacity: 1;
	transform: translate3d(0,0,0);
	pointer-events: auto;
}

Now, let’s have a look at that tip. We’ll be using the ::after pseudo element to add the tip, which is a SVG:


.tooltip-content::after {
	position: absolute;
	top: 100%;
	width: 60px;
	height: 120px;
	background: url(../img/tooltip3.svg) no-repeat center center;
	background-size: 100%;
	content: '';
	transition: transform 0.3s;
	transform-origin: 50% 0;
}

Depending on how we want the tip to turn, we set the rotation. You’ll notice that we use scale3d(-1,1,1) for the right turning tip. This is a way of “reflecting” or “mirroring” an element with CSS.

.tooltip-turnright .tooltip-content::after {
	left: 25%;
	transform: scale3d(-1,1,1) rotate3d(1,1,1,25deg) translate3d(0,-15px,0);
}

.tooltip-turnleft .tooltip-content::after {
	right: 25%;
	transform: rotate3d(1,1,1,25deg) translate3d(0,-15px,0);
}

On hover, we reset the transforms to the final position:

.tooltip-turnright:hover .tooltip-content::after {
	transform: scale3d(-1,1,1) rotate3d(1,1,1,0) translate3d(0,-5px,0);
}

.tooltip-turnleft:hover .tooltip-content::after {
	transform: rotate3d(1,1,1,0) translate3d(0,-5px,0);
}

And that all makes an exquisite tooltip with a unique shape.

We hope you enjoy these styles and get inspired :)

View demo Download source

Previous:
Next:

Tagged with:

Mary Lou (Manoela Ilic) is a freelance web designer and developer with a passion for interaction design. She studied Cognitive Science and Computational Logic and has a weakness for the smell of freshly ground peppercorns.

View all contributions by

Website: http://tympanus.net/

Related Articles

Feedback 49

  1. 2

    Hi, thanks for this tutorial and source code. How to position tooltip below the item?

    • 3

      On .tooltip-content change bottom: 100% to top: 100% . Also, make sure you change the orientation of the tooltip’ arrow.

  2. 4

    hi, this is aswome every style of portfolio i was downloaded. you may be a perfectionicts.i am gelious of your work… thank you

  3. 6

    Hi,
    Anybody please tell me, can I use these tooltips in wordpress website in team slider image to show text regarding each employee when hover on his/her image.

    any help will be appreciated.

    Best Regards.

  4. 7

    Hi,
    I downloaded Tooltip Crazy free . There’s only effect the default layout and default settings. Is there a picture or video instruction? I would appreciate your help .
    Thank you

Follow this discussion

Leave a Comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>