|
| 1 | +@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"); |
| 2 | + |
| 3 | +* { |
| 4 | + box-sizing: border-box; |
| 5 | +} |
| 6 | + |
| 7 | +body { |
| 8 | + font-family: "Roboto", sans-serif; |
| 9 | + display: flex; |
| 10 | + flex-direction: column; |
| 11 | + align-items: center; |
| 12 | + justify-content: center; |
| 13 | + height: 100vh; |
| 14 | + overflow: hidden; |
| 15 | + margin: 0; |
| 16 | + background: #ece9e6; |
| 17 | + background: linear-gradient(to right, #ece9e6, #ffffff); |
| 18 | + text-align: center; |
| 19 | +} |
| 20 | + |
| 21 | +.tooltip { |
| 22 | + background: #4e54c8; |
| 23 | + background: linear-gradient(to right, #4e54c8, #23287a); |
| 24 | + color: #fff; |
| 25 | + font-size: 1.25rem; |
| 26 | + border-radius: 10px; |
| 27 | + padding: 10px 15px; |
| 28 | + position: relative; |
| 29 | + margin: 15px; |
| 30 | +} |
| 31 | + |
| 32 | +/* message */ |
| 33 | + |
| 34 | +.tooltip::after { |
| 35 | + background-color: #313247; |
| 36 | + border-radius: 10px; |
| 37 | + color: #fff; |
| 38 | + display: none; |
| 39 | + padding: 10px 15px; |
| 40 | + font-size: 1rem; |
| 41 | + font-weight: lighter; |
| 42 | + position: absolute; |
| 43 | + z-index: 1; |
| 44 | +} |
| 45 | + |
| 46 | +.tooltip.top::after { |
| 47 | + content: "Top"; |
| 48 | + top: 0; |
| 49 | + left: 50%; |
| 50 | + transform: translate(-50%, calc(-100% - 10px)); |
| 51 | +} |
| 52 | + |
| 53 | +.tooltip.bottom::after { |
| 54 | + content: "Bottom"; |
| 55 | + bottom: 0; |
| 56 | + left: 50%; |
| 57 | + transform: translate(-50%, calc(100% + 10px)); |
| 58 | +} |
| 59 | + |
| 60 | +.tooltip.right::after { |
| 61 | + content: "Right"; |
| 62 | + top: 0; |
| 63 | + right: 0; |
| 64 | + transform: translateX(calc(100% + 10px)); |
| 65 | +} |
| 66 | + |
| 67 | +.tooltip.left::after { |
| 68 | + content: "Left"; |
| 69 | + top: 0; |
| 70 | + left: 0; |
| 71 | + transform: translateX(calc(-100% - 10px)); |
| 72 | +} |
| 73 | + |
| 74 | +.tooltip:hover::after { |
| 75 | + display: block; |
| 76 | +} |
| 77 | + |
| 78 | +/* arrow */ |
| 79 | + |
| 80 | +.tooltip::before { |
| 81 | + content: ""; |
| 82 | + background-color: #313247; |
| 83 | + display: none; |
| 84 | + position: absolute; |
| 85 | + width: 15px; |
| 86 | + height: 15px; |
| 87 | + z-index: 1; |
| 88 | +} |
| 89 | + |
| 90 | +.tooltip:hover::before { |
| 91 | + display: block; |
| 92 | +} |
| 93 | + |
| 94 | +.tooltip.top::before { |
| 95 | + top: 0; |
| 96 | + left: 50%; |
| 97 | + transform: translate(-50%, calc(-100% - 5px)) rotate(45deg); |
| 98 | +} |
| 99 | + |
| 100 | +.tooltip.bottom::before { |
| 101 | + bottom: 0; |
| 102 | + left: 50%; |
| 103 | + transform: translate(-50%, calc(100% + 5px)) rotate(45deg); |
| 104 | +} |
| 105 | + |
| 106 | +.tooltip.right::before { |
| 107 | + top: 50%; |
| 108 | + right: 0; |
| 109 | + transform: translate(calc(100% + 5px), -50%) rotate(45deg); |
| 110 | +} |
| 111 | + |
| 112 | +.tooltip.left::before { |
| 113 | + top: 50%; |
| 114 | + left: 0; |
| 115 | + transform: translate(calc(-100% - 5px), -50%) rotate(45deg); |
| 116 | +} |
0 commit comments