<label for="">
        Your username:
        <input id="username" />
        <span class="callout">
            Only letters,number,underscore(_) and hyphens (-) allowed!
        </span>
    </label>
  body {
    font-family: Cambria, Cochin, Georgia, Times, Times New Roman, serif;
}

 #username {
    display: block;
    width: 300px;
    padding: 10px;
    margin: 15px;
}

.callout {
    position: relative;
    width: 300px;
    margin-left: 15px;
    padding: 10px;
    border: 1px solid yellowgreen;
    background: yellowgreen;
    text-align: justify;
    border-radius: 5px;
    display: none;
}

.callout::before {
    width: 0px;
    height: 0px;
    content: '';
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid yellowgreen;
    position: absolute;
    top: -8px;
    left: 5px;
}

input:not(:focus) + .callout{
    transform:scale(0);
    transition-timing-function:ease;   /*覆盖cubic-bezier*/
}
        
.callout{
    display: block;
    transform-origin:1.4em -.4em;
    transition:.5s cubic-bezier(.25,.1,.3,1.5);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.