KLoning Spoon

  • Archive
  • RSS
  • Ask me anything
The idea is to have a list with links or in our case, social icons, that reveal a little tooltip on hover.
The unordered list will look like this:
<ul class="tt-wrapper">
	<li><a class="tt-gplus" href="#"><span>Google Plus</span></a></li>
	<li><a class="tt-twitter" href="#"><span>Twitter</span></a></li>
	<li><a class="tt-dribbble" href="#"><span>Dribbble</span></a></li>
	<li><a class="tt-facebook" href="#"><span>Facebook</span></a></li>
	<li><a class="tt-linkedin" href="#"><span>LinkedIn</span></a></li>
	<li><a class="tt-forrst" href="#"><span>Forrst</span></a></li>
</ul>

The list elements will be floating left and the anchors will have the following style:
.tt-wrapper li a{
	display: block;
	width: 68px;
	height: 70px;
	margin: 0 2px;
	outline: none;
	background: transparent url(../images/icons.png) no-repeat top left;
	position: relative;
}

Each anchor will have a different background position for the background image:
.tt-wrapper li .tt-gplus{
    background-position: 0px 0px;
}
.tt-wrapper li .tt-twitter{
    background-position: -68px 0px;
}
.tt-wrapper li .tt-dribbble{
    background-position: -136px 0px;
}
.tt-wrapper li .tt-facebook{
    background-position: -204px 0px;
}
.tt-wrapper li .tt-linkedin{
    background-position: -272px 0px;
}
.tt-wrapper li .tt-forrst{
    background-position: -340px 0px;
}

The span will work as our tooltip and we will “hide” it by setting  its initial opacity to 0. The effect I want to share with you is the  tooltip fading in and appearing from the top, so we will give it a  bottom of 100px, placing it above the anchor:
.tt-wrapper li a span{
	width: 100px;
	height: auto;
	line-height: 20px;
	padding: 10px;
	left: 50%;
	margin-left: -64px;
	font-family: 'Alegreya SC', Georgia, serif;
	font-weight: 400;
	font-style: italic;
	font-size: 14px;
	color: #719DAB;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
	text-align: center;
	border: 4px solid #fff;
	background: rgba(255,255,255,0.3);
	text-indent: 0px;
	border-radius: 5px;
	position: absolute;
    pointer-events: none;
	bottom: 100px;
	opacity: 0;
	box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
	transition: all 0.3s ease-in-out;
}

Since we will make the tooltip appear on hover over the anchor (and  the span counts as part of the anchor) the tooltip will also appear when  hovering over the area above the anchor (the span is still there, it’s just the 0 opacity that makes it invisible).
For the little pointer, we will style the pseudo-elements :before and  :after. We will style them the same way and create a triangle by using  transparent left and right borders. The :before pseudo-element will  serve as a shadow for the :after pseudo-element, so we’ll give it a  black rgba value with a low opacity:
.tt-wrapper li a span:before,
.tt-wrapper li a span:after{
	content: '';
	position: absolute;
	bottom: -15px;
	left: 50%;
	margin-left: -9px;
	width: 0;
	height: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-top: 10px solid rgba(0,0,0,0.1);
}

The :after pseudo-element will be placed a pixel away and we’ll make it white, just like the border of the tooltip itself:
.tt-wrapper li a span:after{
	bottom: -14px;
	margin-left: -10px;
	border-top: 10px solid #fff;
}

So, on hover, we will make the span move from the top and fade in:
.tt-wrapper li a:hover span{
	opacity: 0.9;
	bottom: 70px;
}
Pop-upView Separately

The idea is to have a list with links or in our case, social icons, that reveal a little tooltip on hover.

The unordered list will look like this:

<ul class="tt-wrapper">
	<li><a class="tt-gplus" href="#"><span>Google Plus</span></a></li>
	<li><a class="tt-twitter" href="#"><span>Twitter</span></a></li>
	<li><a class="tt-dribbble" href="#"><span>Dribbble</span></a></li>
	<li><a class="tt-facebook" href="#"><span>Facebook</span></a></li>
	<li><a class="tt-linkedin" href="#"><span>LinkedIn</span></a></li>
	<li><a class="tt-forrst" href="#"><span>Forrst</span></a></li>
</ul>

The list elements will be floating left and the anchors will have the following style:

.tt-wrapper li a{
	display: block;
	width: 68px;
	height: 70px;
	margin: 0 2px;
	outline: none;
	background: transparent url(../images/icons.png) no-repeat top left;
	position: relative;
}

Each anchor will have a different background position for the background image:

.tt-wrapper li .tt-gplus{
    background-position: 0px 0px;
}
.tt-wrapper li .tt-twitter{
    background-position: -68px 0px;
}
.tt-wrapper li .tt-dribbble{
    background-position: -136px 0px;
}
.tt-wrapper li .tt-facebook{
    background-position: -204px 0px;
}
.tt-wrapper li .tt-linkedin{
    background-position: -272px 0px;
}
.tt-wrapper li .tt-forrst{
    background-position: -340px 0px;
}

The span will work as our tooltip and we will “hide” it by setting its initial opacity to 0. The effect I want to share with you is the tooltip fading in and appearing from the top, so we will give it a bottom of 100px, placing it above the anchor:

.tt-wrapper li a span{
	width: 100px;
	height: auto;
	line-height: 20px;
	padding: 10px;
	left: 50%;
	margin-left: -64px;
	font-family: 'Alegreya SC', Georgia, serif;
	font-weight: 400;
	font-style: italic;
	font-size: 14px;
	color: #719DAB;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
	text-align: center;
	border: 4px solid #fff;
	background: rgba(255,255,255,0.3);
	text-indent: 0px;
	border-radius: 5px;
	position: absolute;
    pointer-events: none;
	bottom: 100px;
	opacity: 0;
	box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
	transition: all 0.3s ease-in-out;
}

Since we will make the tooltip appear on hover over the anchor (and the span counts as part of the anchor) the tooltip will also appear when hovering over the area above the anchor (the span is still there, it’s just the 0 opacity that makes it invisible).

For the little pointer, we will style the pseudo-elements :before and :after. We will style them the same way and create a triangle by using transparent left and right borders. The :before pseudo-element will serve as a shadow for the :after pseudo-element, so we’ll give it a black rgba value with a low opacity:

.tt-wrapper li a span:before,
.tt-wrapper li a span:after{
	content: '';
	position: absolute;
	bottom: -15px;
	left: 50%;
	margin-left: -9px;
	width: 0;
	height: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-top: 10px solid rgba(0,0,0,0.1);
}

The :after pseudo-element will be placed a pixel away and we’ll make it white, just like the border of the tooltip itself:

.tt-wrapper li a span:after{
	bottom: -14px;
	margin-left: -10px;
	border-top: 10px solid #fff;
}

So, on hover, we will make the span move from the top and fade in:

.tt-wrapper li a:hover span{
	opacity: 0.9;
	bottom: 70px;
}

Source: j.mp

    • #css3
    • #tooltips
    • #animate
  • 1 year ago
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Recent comments

Blog comments powered by Disqus
← Previous • Next →

About

Avatar Darto KLoning - We Share Because We Care

Pages

  • About Me
  • Contact Me

Me, Elsewhere

  • @dartokloning on Twitter
  • dartokloning on Youtube
  • kloningspoon on Flickr
  • dartokloning on Delicious
  • dartokloning on Foursquare
  • Google
  • My Skype Info
  • Linkedin Profile

Twitter

Instagram

loading tweets…

loading photos…

I Dig These Posts

See more →
  • Photo via joshlafayette

    IS IT TIME FOR SLEEP?

    Redo of an oldie.

    Prints and more in my Society6 shop!

    Photo via joshlafayette
  • Photoset via fer1972

    Carved Tires by Wim Delvoye

    Photoset via fer1972
  • Photoset via cjwho

    P.S. Restaurant by Golucci International Design

    Photoset via cjwho
  • Photo via llbwwb

    For the horse lovers:) by Justin Lo.

    Photo via llbwwb
  • Photo via llbwwb

    For the tiger lovers:) I just wanna be alone by ~TlCphotography730 ..

    Photo via llbwwb
  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile
Effector Theme by Pixel Union