|
| 1 | +/*************************************************************************** |
| 2 | +* Assume that we want the arrow's size (i.e. side; height in case it's on * |
| 3 | +* the left or right side; width otherwise) to be 16px. Then the border * |
| 4 | +* width for the arrow and its border will be half that dimension, 8px. In * |
| 5 | +* order for the arrow to be right on the tooltip, the arrow border's left * |
| 6 | +* positioning has to be as much as it's size, therefore -16px. The arrow's * |
| 7 | +* left positioning has to be a couple of pixels to the right in order for * |
| 8 | +* the border effect to be visible, therefore -14px. At the same time, in * |
| 9 | +* order for the arrow's point to not overlap with the targeted item, the * |
| 10 | +* tooltip's left margin has to be half the arrow's size (=the arrow's * |
| 11 | +* border width), 8px. The tooltip's padding has to at least as much as the * |
| 12 | +* arrow's left positioning overhead, (-(-16px-(-14px))) 2px in this case. * |
| 13 | +* The arrow's and the arrow border's top positioning can be as much as we * |
| 14 | +* want, and it must be the same for both. * |
| 15 | +* * |
| 16 | +* Desired arrow's size ([height|width]): 16px * |
| 17 | +* Arrow's border-width: 8px (half the arrow's size) * |
| 18 | +* Tooltip's [left|right] margin: 8px (half the arrow's size) * |
| 19 | +* Arrow's [left|right] positioning: -16px & -14px (arrow border and arrow) * |
| 20 | +* Arrow's [top|bottom] positioning: 8px * |
| 21 | +* * |
| 22 | +***************************************************************************/ |
| 23 | + |
| 24 | +/* Arrow implementation using traditional elements */ |
| 25 | +.ttn { |
| 26 | + /* Display */ |
| 27 | + position: absolute; |
| 28 | + display: none; |
| 29 | + z-index: 9997; |
| 30 | + |
| 31 | + /* Dimensions */ |
| 32 | + max-width: 250px; |
| 33 | + min-width: 150px; |
| 34 | + |
| 35 | + /* Contents */ |
| 36 | + background: #FFFFCC; |
| 37 | + margin-left: 8px; |
| 38 | + padding: 5px; /* padding has to be at least 2 */ |
| 39 | + font-size: small; |
| 40 | + |
| 41 | + /* Border */ |
| 42 | + border: 1px solid #FFCC00; |
| 43 | + -moz-border-radius: 5px; |
| 44 | + -webkit-border-radius: 5px; |
| 45 | + -o-border-radius: 5px; |
| 46 | + border-radius: 5px; |
| 47 | + |
| 48 | + /* Shadow */ |
| 49 | + -moz-box-shadow: 1px 1px 3px gray; |
| 50 | + -webkit-box-shadow: 1px 1px 3px gray; |
| 51 | + -o-box-shadow: 1px 1px 3px gray; |
| 52 | + box-shadow: 1px 1px 3px gray; |
| 53 | +} |
| 54 | + |
| 55 | +.ttn_arrow { |
| 56 | + /* Display */ |
| 57 | + position: absolute; |
| 58 | + left: -14px; |
| 59 | + top: 8px; |
| 60 | + z-index: 9999; |
| 61 | + |
| 62 | + /* Dimensions */ |
| 63 | + height: 0; |
| 64 | + width: 0; |
| 65 | + |
| 66 | + /* Border */ |
| 67 | + border-color: transparent #FFFFCC transparent transparent; |
| 68 | + border-color: rgba(255,255,255,0) #FFFFCC rgba(255,255,255,0) rgba(255,255,255,0); |
| 69 | + border-style: solid; |
| 70 | + border-width: 8px; |
| 71 | +} |
| 72 | + |
| 73 | +.ttn_arrow_border { |
| 74 | + /* Display */ |
| 75 | + position: absolute; |
| 76 | + left: -16px; |
| 77 | + top: 8px; |
| 78 | + z-index: 9998; |
| 79 | + |
| 80 | + /* Dimensions */ |
| 81 | + height: 0; |
| 82 | + width: 0; |
| 83 | + |
| 84 | + /* Border */ |
| 85 | + border-color: transparent #FFCC00 transparent transparent; |
| 86 | + border-color: rgba(255,255,255,0) #FFCC00 rgba(255,255,255,0) rgba(255,255,255,0); |
| 87 | + border-style: solid; |
| 88 | + border-width: 8px; |
| 89 | +} |
| 90 | + |
| 91 | +/* Arrow implementation using the :before and :after pseudo elements */ |
| 92 | +.ttn_alt_arrow_box { |
| 93 | + /* Display */ |
| 94 | + position: absolute; |
| 95 | + display: none; |
| 96 | + z-index: 9997; |
| 97 | + |
| 98 | + /* Dimensions */ |
| 99 | + max-width: 250px; |
| 100 | + min-width: 150px; |
| 101 | + |
| 102 | + /* Contents */ |
| 103 | + background: #FFFFCC; |
| 104 | + margin-left: 6px; |
| 105 | + padding: 3px; |
| 106 | + |
| 107 | + /* Border */ |
| 108 | + border: 1px solid #FFCC00; |
| 109 | + -moz-border-radius: 5px; |
| 110 | + -webkit-border-radius: 5px; |
| 111 | + -o-border-radius: 5px; |
| 112 | + border-radius: 5px; |
| 113 | + |
| 114 | + /* Shadow */ |
| 115 | + -moz-box-shadow: 1px 1px 3px gray; |
| 116 | + -webkit-box-shadow: 1px 1px 3px gray; |
| 117 | + -o-box-shadow: 1px 1px 3px gray; |
| 118 | + box-shadow: 1px 1px 3px gray; |
| 119 | +} |
| 120 | + |
| 121 | +.ttn_alt_arrow_box:after, .ttn_alt_arrow_box:before { |
| 122 | + right: 100%; |
| 123 | + border: 1px solid transparent; |
| 124 | + content: " "; |
| 125 | + height: 0; |
| 126 | + width: 0; |
| 127 | + position: absolute; |
| 128 | + pointer-events: none; |
| 129 | +} |
| 130 | + |
| 131 | +.ttn_alt_arrow_box:after { |
| 132 | + border-color: transparent; |
| 133 | + border-right-color: #FFFFCC; |
| 134 | + border-width: 6px; |
| 135 | + top: 13px; |
| 136 | +} |
| 137 | + |
| 138 | +.ttn_alt_arrow_box:before { |
| 139 | + border-color: transparent; |
| 140 | + border-right-color: #FFCC00; |
| 141 | + border-width: 8px; |
| 142 | + top: 11px; |
| 143 | +} |
| 144 | + |
| 145 | +/* Style for the tooltip's contents */ |
| 146 | +.ttn_text { |
| 147 | + /* Contents */ |
| 148 | + vertical-align: top; |
| 149 | + text-align: left; |
| 150 | +} |
| 151 | + |
| 152 | +.ttn_actions { |
| 153 | + /* Contents */ |
| 154 | + vertical-align: bottom; |
| 155 | + text-align: right; |
| 156 | +} |
| 157 | + |
| 158 | +.ttn_actions_read_more { |
| 159 | +} |
| 160 | + |
| 161 | +.ttn_actions_dismiss { |
| 162 | +} |
0 commit comments