<form>
  <input type="text" placeholder="username"/>
  <div id="anim">
    <span class="tooltip" data-tooltip="username must consist of 29 symbols.">?</span>
    </div>
    </form>
$pink: #ff3466;
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400');
body {
  background: #424B54;
  font-family: 'Source Sans Pro', sans-serif;
  overflow: hidden;
}

form {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100vh;
}

input {
  border: none;
  width: 170px;
  height: 25px;
  outline: none;
  padding-left: 10px;
}

.tooltip {
  position: relative;
  background: $pink;
  padding: 5px 12px;
  margin: 5px;
  font-size: 15px;
  border-radius: 100%;
  color: #FFF;
}

.tooltip:before,
.tooltip:after {
  position: absolute;
  content: '';
  opacity: 0;
  transition: all 0.4s ease;
}

.tooltip:before {
  border-width: 10px 8px 0 8px;
  border-style: solid;
  border-color: $pink transparent transparent transparent;
  top: -15px;
   transform: translateY(20px);
}

.tooltip:after {
  content: attr(data-tooltip);
  background: $pink;
  width: 160px;
  height: 40px;
  font-size: 13px;
  font-weight: 300;
  top: -75px;
  left: -10px;
  padding: 10px;
  border-radius: 5px;
  letter-spacing: 1px;
  transform: translateY(20px);
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  transform: translateY(-2px);
}

@keyframes shake {
  0% { 
    transform: rotate(2deg);
  }
  50% {
   transform: rotate(-3deg);
  }
  70% {
    transform: rotate(3deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

#anim:hover {
  animation: shake 500ms ease-in-out forwards;
}
View Compiled

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css

External JavaScript

This Pen doesn't use any external JavaScript resources.