<style> . 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: #67AB05; 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: #67AB05 transparent transparent transparent; top: -15px; transform: translateY(20px); } .tooltip:after { content: attr(data-tooltip); background: #67AB05; 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 SCSS Code Resources </style>
$(function(){ $('#p48_chosen').addClass('tooltip'); $('#p44_chosen').addClass('tooltip'); });
<div id="anim"> <span class="tooltip" data-tooltip="Хз что это, но очень интересно !">?</span> </div>
<div class="tooltip"> <div class="tooltip-content"> <div class="tooltip-arrow"></div> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempore blanditiis, placeat minus</p> </div> </div>
.tooltip { position: relative; width: 100%; max-width: 200px; height: 50px; margin: 200px auto; border: 1px solid #808080; cursor: pointer; } .tooltip:hover .tooltip-content { display: block; animation: tooltip 0.7s ease forwards; } .tooltip-content { display: none; opacity: 0; position: absolute; bottom: calc(100% + 50px); left: 50%; transform: translateX(-50%); width: 100%; max-width: 350px; min-width: 300px; padding: 5px; border: 1px solid #e9e9e9; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.15); } .tooltip-arrow { position: absolute; z-index: 1; bottom: -15px; left: 50%; transform: translateX(-50%); width: 20px; height: 25px; overflow: hidden; } .tooltip-arrow:before { content: ''; position: absolute; top: -4px; left: 50%; width: 20px; height: 20px; background-color: #fff; transform: translateX(-50%) rotate(45deg); box-shadow: 8px 8px 9px -4px rgba(0,0,0,0.15); } @-moz-keyframes tooltip { 100% { opacity: 1; bottom: calc(100% + 30px); } } @-webkit-keyframes tooltip { 100% { opacity: 1; bottom: calc(100% + 30px); } } @-o-keyframes tooltip { 100% { opacity: 1; bottom: calc(100% + 30px); } } @keyframes tooltip { 100% { opacity: 1; bottom: calc(100% + 30px); } }