No Description

_tooltip.scss 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // Tooltips
  3. // --------------------------------------------------
  4. // Base class
  5. .tooltip {
  6. position: absolute;
  7. z-index: $zindex-tooltip;
  8. display: block;
  9. // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
  10. // So reset our font and text properties to avoid inheriting weird values.
  11. @include reset-text;
  12. font-size: $font-size-small;
  13. @include opacity(0);
  14. &.in { @include opacity($tooltip-opacity); }
  15. &.top { margin-top: -3px; padding: $tooltip-arrow-width 0; }
  16. &.right { margin-left: 3px; padding: 0 $tooltip-arrow-width; }
  17. &.bottom { margin-top: 3px; padding: $tooltip-arrow-width 0; }
  18. &.left { margin-left: -3px; padding: 0 $tooltip-arrow-width; }
  19. }
  20. // Wrapper for the tooltip content
  21. .tooltip-inner {
  22. max-width: $tooltip-max-width;
  23. padding: 3px 8px;
  24. color: $tooltip-color;
  25. text-align: center;
  26. background-color: $tooltip-bg;
  27. border-radius: $border-radius-base;
  28. }
  29. // Arrows
  30. .tooltip-arrow {
  31. position: absolute;
  32. width: 0;
  33. height: 0;
  34. border-color: transparent;
  35. border-style: solid;
  36. }
  37. // Note: Deprecated .top-left, .top-right, .bottom-left, and .bottom-right as of v3.3.1
  38. .tooltip {
  39. &.top .tooltip-arrow {
  40. bottom: 0;
  41. left: 50%;
  42. margin-left: -$tooltip-arrow-width;
  43. border-width: $tooltip-arrow-width $tooltip-arrow-width 0;
  44. border-top-color: $tooltip-arrow-color;
  45. }
  46. &.top-left .tooltip-arrow {
  47. bottom: 0;
  48. right: $tooltip-arrow-width;
  49. margin-bottom: -$tooltip-arrow-width;
  50. border-width: $tooltip-arrow-width $tooltip-arrow-width 0;
  51. border-top-color: $tooltip-arrow-color;
  52. }
  53. &.top-right .tooltip-arrow {
  54. bottom: 0;
  55. left: $tooltip-arrow-width;
  56. margin-bottom: -$tooltip-arrow-width;
  57. border-width: $tooltip-arrow-width $tooltip-arrow-width 0;
  58. border-top-color: $tooltip-arrow-color;
  59. }
  60. &.right .tooltip-arrow {
  61. top: 50%;
  62. left: 0;
  63. margin-top: -$tooltip-arrow-width;
  64. border-width: $tooltip-arrow-width $tooltip-arrow-width $tooltip-arrow-width 0;
  65. border-right-color: $tooltip-arrow-color;
  66. }
  67. &.left .tooltip-arrow {
  68. top: 50%;
  69. right: 0;
  70. margin-top: -$tooltip-arrow-width;
  71. border-width: $tooltip-arrow-width 0 $tooltip-arrow-width $tooltip-arrow-width;
  72. border-left-color: $tooltip-arrow-color;
  73. }
  74. &.bottom .tooltip-arrow {
  75. top: 0;
  76. left: 50%;
  77. margin-left: -$tooltip-arrow-width;
  78. border-width: 0 $tooltip-arrow-width $tooltip-arrow-width;
  79. border-bottom-color: $tooltip-arrow-color;
  80. }
  81. &.bottom-left .tooltip-arrow {
  82. top: 0;
  83. right: $tooltip-arrow-width;
  84. margin-top: -$tooltip-arrow-width;
  85. border-width: 0 $tooltip-arrow-width $tooltip-arrow-width;
  86. border-bottom-color: $tooltip-arrow-color;
  87. }
  88. &.bottom-right .tooltip-arrow {
  89. top: 0;
  90. left: $tooltip-arrow-width;
  91. margin-top: -$tooltip-arrow-width;
  92. border-width: 0 $tooltip-arrow-width $tooltip-arrow-width;
  93. border-bottom-color: $tooltip-arrow-color;
  94. }
  95. }