Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. html code
  2. <div id="tool" data-tool='Привет!'>Наведи на меня</div>
  3.  
  4. css code
  5. #tool{
  6. cursor: help;
  7. position: relative;
  8. }
  9.  
  10. #tool::before,
  11. #tool::after {
  12. left: 50%;
  13. opacity: 0;
  14. position: absolute;
  15. z-index: -1;
  16. }
  17.  
  18. #tool:hover::before,
  19. #tool:focus::before,
  20. #tool:hover::after,
  21. #tool:focus::after {
  22. opacity: 1;
  23. z-index: 1;
  24. }
  25.  
  26. #tool::before {
  27. border-style: solid;
  28. border-width: 1em;
  29. border-color: #2c86b3 transparent transparent transparent;
  30. bottom: 100%;
  31. content: "";
  32. margin-left: -2em;
  33. top: -2em;
  34. transition: opacity 1s ease, top .5s ease;
  35. }
  36.  
  37. #tool:hover::before,
  38. #tool:focus::before {
  39. top: -1em;
  40. }
  41. #tool::after { /*действия при наведении*/
  42. background: #2c86b3;
  43. bottom: 170%;
  44. color: white;
  45. content: attr(data-tool); /*выводит текст из html*/
  46. margin-left: -8.75em;
  47. padding: 1em;
  48. width: 14em;
  49. transition: opacity 0.6s ease;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement