<div class="tooltip">
  <div class="tooltip--container">
    <div class="tooltip--text animated">
      鼠标移到我身上来(^_^)
    </div>
    <div class="tooltip--tip animated"></div>
  </div>
</div>
/*=================================
= CSS-only tooltip with a shadow! =
=         by Matthew Ström        =
=        http://planetary.io      =
=================================*/

html {
  box-sizing: border-box;
  font-size: 20px;
  line-height: 1.5;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
  font-family: Georgia, serif;
  background: #eee;
  color: #333;
}

/* this sets the scene */

.tooltip {
  width: 40rem;
  text-align: center;
  margin: 14rem auto;
  position: relative;
}

/* here's where the magic happens */

.tooltip--container {
  position: absolute;
  z-index:0;
  top: calc(-100% - 2.5rem);
  left: 50%;
  transform: translateX(-50%);
}

.tooltip--text:before,
.tooltip--text:after{
  display: block;
  content: "";
  position: absolute;
  z-index: -100;
  width: 50%;
  top: 0;
  bottom: 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  transition: transform 200ms ease-out;
}

.tooltip--text:before {
  left: 0;
  border-bottom-right-radius: 1rem;
}

.tooltip--text:after{
  right: 0;
  border-bottom-left-radius: 1rem;
}

.tooltip--text {
  background: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
}

.tooltip--tip {
  position: absolute;
  z-index: -100;
  display: block;
  width: 1rem;
  height: 1rem;
  background: #fff;
  left: 50%;
  bottom: -0.5rem;
  transform: 
    translateX(-50%)
    rotate(45deg);
  box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
  transition: transform 200ms ease-out;
}

.tooltip--source {
  font-size: 2rem;
  line-height: 1.5rem;
  font-style: italic;
}

/* this stuff is just for show — leave it out of production */

.animated,
.animated:before
.animated:after {
  transition: transform 200ms ease-out;

}

.tooltip--container:hover {
  
  .tooltip--text:before{
    transform: translateX(-110%);
  }
  
  .tooltip--text:after{
    transform: translateX(110%);
  }
  
  .tooltip--tip {
    transform: 
      translateY(100%)
      translateX(-50%)
      rotate(45deg);
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.