<h2>CSS Only Tooltip</h2> <br/><br/> <span data-tooltip-text="THIS IS TOOLTIP!!">TOOLTIP TEST</span> <br/><br/> <span data-tooltip-text="My Heart leaps up when I behold A rainbow in the sky: So was it when my life began; So be it now I am a man So be it when I shall grow old, Or let me die! The Child is father of the Man; And I could wish my days to be Bound each to by natural piety.">THIS IS LONG TOOLTIP</span> <br/><br/>
/* css-only-tooltip version 1.0.0 ⓒ 2015 AHN JAE-HA http://github.com/eu81273 MIT License */ [data-tooltip-text]:hover { position: relative; } [data-tooltip-text]:after { -webkit-transition: bottom .3s ease-in-out, opacity .3s ease-in-out; -moz-transition: bottom .3s ease-in-out, opacity .3s ease-in-out; transition: bottom .3s ease-in-out, opacity .3s ease-in-out; background-color: rgba(0, 0, 0, 0.8); -webkit-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4); -moz-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4); box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4); -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #FFFFFF; font-size: 12px; margin-bottom: 10px; padding: 7px 12px; position: absolute; width: auto; min-width: 50px; max-width: 300px; word-wrap: break-word; z-index: 9999; opacity: 0; left: -9999px; top: 90%; content: attr(data-tooltip-text); } [data-tooltip-text]:hover:after { top: 130%; left: 0; opacity: 1; }