Show tooltip on words inside a paragraph - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Tooltip

Description

Show tooltip on words inside a paragraph

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div {<!--   www . j  a  v  a 2  s  . c  o  m-->
   width:401px;
   overflow:visible;
   outline:solid 2px black;
}

span, a {
   display:inline-block;
   color:Chartreuse;
   position:relative;
   border:2px solid yellow;
   padding:0;
}

span:hover::before,
a:hover::before {
   display:inline-block;
   background:firebrick ;
   border-radius:6px;
   bottom:27px;
   color:blue;
   content:'tooltip text';
   left:calc(81% - 7px);
   padding:6px 16px;
   position:absolute;
   width:121px;
}

span:hover::after,
a:hover::after {
   display:inline-block;
   border:solid;
   border-color:pink;
   border-color:OrangeRed;
   border-width:7px 7px 0 7px;
   bottom:21px;
   content:"";
   left:81%;
   position:absolute;
}
</style> 
 </head> 
 <body> 
  <div> 
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vi<span>Lorem ipsum dolor sit amet</span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat v<a>Lore</a>Lorem ipsum dolor sit ame<span>Lorem ipsum </span>Lorem ip<span>Lore</span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi<span>Lorem </span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornar<span>Lorem ipsum </span>Lorem ipsum dolor sit am</p> 
  </div>  
 </body>
</html>

Related Tutorials