mixins.less 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. // Mixins.less
  2. // Snippets of reusable CSS to develop faster and keep code readable
  3. // -----------------------------------------------------------------
  4. // UTILITY MIXINS
  5. // --------------------------------------------------
  6. // Clearfix
  7. // --------
  8. // For clearing floats like a boss h5bp.com/q
  9. .clearfix() {
  10. *zoom: 1;
  11. &:before,
  12. &:after {
  13. display: table;
  14. content: "";
  15. }
  16. &:after {
  17. clear: both;
  18. }
  19. }
  20. // Webkit-style focus
  21. // ------------------
  22. .tab-focus() {
  23. // Default
  24. outline: thin dotted;
  25. // Webkit
  26. outline: 5px auto -webkit-focus-ring-color;
  27. outline-offset: -2px;
  28. }
  29. // Center-align a block level element
  30. // ----------------------------------
  31. .center-block() {
  32. display: block;
  33. margin-left: auto;
  34. margin-right: auto;
  35. }
  36. // IE7 inline-block
  37. // ----------------
  38. .ie7-inline-block() {
  39. *display: inline; /* IE7 inline-block hack */
  40. *zoom: 1;
  41. }
  42. // IE7 likes to collapse whitespace on either side of the inline-block elements.
  43. // Ems because we're attempting to match the width of a space character. Left
  44. // version is for form buttons, which typically come after other elements, and
  45. // right version is for icons, which come before. Applying both is ok, but it will
  46. // mean that space between those elements will be .6em (~2 space characters) in IE7,
  47. // instead of the 1 space in other browsers.
  48. .ie7-restore-left-whitespace() {
  49. *margin-left: .3em;
  50. &:first-child {
  51. *margin-left: 0;
  52. }
  53. }
  54. .ie7-restore-right-whitespace() {
  55. *margin-right: .3em;
  56. &:last-child {
  57. *margin-left: 0;
  58. }
  59. }
  60. // Sizing shortcuts
  61. // -------------------------
  62. .size(@height: 5px, @width: 5px) {
  63. width: @width;
  64. height: @height;
  65. }
  66. .square(@size: 5px) {
  67. .size(@size, @size);
  68. }
  69. // Placeholder text
  70. // -------------------------
  71. .placeholder(@color: @placeholderText) {
  72. :-moz-placeholder {
  73. color: @color;
  74. }
  75. ::-webkit-input-placeholder {
  76. color: @color;
  77. }
  78. }
  79. // Text overflow
  80. // -------------------------
  81. // Requires inline-block or block for proper styling
  82. .text-overflow() {
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. white-space: nowrap;
  86. }
  87. // FONTS
  88. // --------------------------------------------------
  89. #font {
  90. #family {
  91. .serif() {
  92. font-family: Georgia, "Times New Roman", Times, serif;
  93. }
  94. .sans-serif() {
  95. font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  96. }
  97. .monospace() {
  98. font-family: Menlo, Monaco, "Courier New", monospace;
  99. }
  100. }
  101. .shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
  102. font-size: @size;
  103. font-weight: @weight;
  104. line-height: @lineHeight;
  105. }
  106. .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
  107. #font > #family > .serif;
  108. #font > .shorthand(@size, @weight, @lineHeight);
  109. }
  110. .sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
  111. #font > #family > .sans-serif;
  112. #font > .shorthand(@size, @weight, @lineHeight);
  113. }
  114. .monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
  115. #font > #family > .monospace;
  116. #font > .shorthand(@size, @weight, @lineHeight);
  117. }
  118. }
  119. // GRID SYSTEM
  120. // --------------------------------------------------
  121. // Site container
  122. // -------------------------
  123. .container-fixed() {
  124. width: @gridRowWidth;
  125. margin-left: auto;
  126. margin-right: auto;
  127. .clearfix();
  128. }
  129. // Le grid system
  130. // -------------------------
  131. #gridSystem {
  132. // Setup the mixins to be used
  133. .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, @columns) {
  134. width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
  135. }
  136. .offset(@gridColumnWidth, @gridGutterWidth, @columns) {
  137. margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2);
  138. }
  139. .gridColumn(@gridGutterWidth) {
  140. float: left;
  141. margin-left: @gridGutterWidth;
  142. }
  143. // Take these values and mixins, and make 'em do their thang
  144. .generate(@gridColumns, @gridColumnWidth, @gridGutterWidth) {
  145. // Row surrounds the columns
  146. .row {
  147. margin-left: @gridGutterWidth * -1;
  148. .clearfix();
  149. }
  150. // Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7, thanks @dhg)
  151. [class*="span"] {
  152. #gridSystem > .gridColumn(@gridGutterWidth);
  153. }
  154. // Default columns
  155. .span1 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 1); }
  156. .span2 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 2); }
  157. .span3 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 3); }
  158. .span4 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 4); }
  159. .span5 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 5); }
  160. .span6 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 6); }
  161. .span7 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 7); }
  162. .span8 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 8); }
  163. .span9 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 9); }
  164. .span10 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 10); }
  165. .span11 { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 11); }
  166. .span12,
  167. .container { #gridSystem > .columns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 12); }
  168. // Offset column options
  169. .offset1 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 1); }
  170. .offset2 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 2); }
  171. .offset3 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 3); }
  172. .offset4 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 4); }
  173. .offset5 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 5); }
  174. .offset6 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 6); }
  175. .offset7 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 7); }
  176. .offset8 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 8); }
  177. .offset9 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 9); }
  178. .offset10 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 10); }
  179. .offset11 { #gridSystem > .offset(@gridColumnWidth, @gridGutterWidth, 11); }
  180. }
  181. }
  182. // Fluid grid system
  183. // -------------------------
  184. #fluidGridSystem {
  185. // Setup the mixins to be used
  186. .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, @columns) {
  187. width: 1% * (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
  188. }
  189. .gridColumn(@fluidGridGutterWidth) {
  190. float: left;
  191. margin-left: @fluidGridGutterWidth;
  192. }
  193. // Take these values and mixins, and make 'em do their thang
  194. .generate(@gridColumns, @fluidGridColumnWidth, @fluidGridGutterWidth) {
  195. // Row surrounds the columns
  196. .row-fluid {
  197. width: 100%;
  198. .clearfix();
  199. // Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7, thanks @dhg)
  200. > [class*="span"] {
  201. #fluidGridSystem > .gridColumn(@fluidGridGutterWidth);
  202. }
  203. > [class*="span"]:first-child {
  204. margin-left: 0;
  205. }
  206. // Default columns
  207. .span1 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 1); }
  208. .span2 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 2); }
  209. .span3 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 3); }
  210. .span4 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 4); }
  211. .span5 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 5); }
  212. .span6 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 6); }
  213. .span7 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 7); }
  214. .span8 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 8); }
  215. .span9 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 9); }
  216. .span10 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 10); }
  217. .span11 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 11); }
  218. .span12 { #fluidGridSystem > .columns(@fluidGridGutterWidth, @fluidGridColumnWidth, 12); }
  219. }
  220. }
  221. }
  222. // Input grid system
  223. // -------------------------
  224. #inputGridSystem {
  225. .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, @columns) {
  226. width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 10;
  227. }
  228. .generate(@gridColumns, @gridColumnWidth, @gridGutterWidth) {
  229. input,
  230. textarea,
  231. .uneditable-input {
  232. &.span1 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 1); }
  233. &.span2 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 2); }
  234. &.span3 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 3); }
  235. &.span4 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 4); }
  236. &.span5 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 5); }
  237. &.span6 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 6); }
  238. &.span7 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 7); }
  239. &.span8 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 8); }
  240. &.span9 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 9); }
  241. &.span10 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 10); }
  242. &.span11 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 11); }
  243. &.span12 { #inputGridSystem > .inputColumns(@gridGutterWidth, @gridColumnWidth, @gridRowWidth, 12); }
  244. }
  245. }
  246. }
  247. // Form field states (used in forms.less)
  248. // --------------------------------------------------
  249. // Mixin for form field states
  250. .formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) {
  251. // Set the text color
  252. > label,
  253. .help-block,
  254. .help-inline {
  255. color: @textColor;
  256. }
  257. // Style inputs accordingly
  258. input,
  259. select,
  260. textarea {
  261. color: @textColor;
  262. border-color: @borderColor;
  263. &:focus {
  264. border-color: darken(@borderColor, 10%);
  265. .box-shadow(0 0 6px lighten(@borderColor, 20%));
  266. }
  267. }
  268. // Give a small background color for input-prepend/-append
  269. .input-prepend .add-on,
  270. .input-append .add-on {
  271. color: @textColor;
  272. background-color: @backgroundColor;
  273. border-color: @textColor;
  274. }
  275. }
  276. // CSS3 PROPERTIES
  277. // --------------------------------------------------
  278. // Border Radius
  279. .border-radius(@radius: 5px) {
  280. -webkit-border-radius: @radius;
  281. -moz-border-radius: @radius;
  282. border-radius: @radius;
  283. }
  284. // Drop shadows
  285. .box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
  286. -webkit-box-shadow: @shadow;
  287. -moz-box-shadow: @shadow;
  288. box-shadow: @shadow;
  289. }
  290. // Transitions
  291. .transition(@transition) {
  292. -webkit-transition: @transition;
  293. -moz-transition: @transition;
  294. -ms-transition: @transition;
  295. -o-transition: @transition;
  296. transition: @transition;
  297. }
  298. // Transformations
  299. .rotate(@degrees) {
  300. -webkit-transform: rotate(@degrees);
  301. -moz-transform: rotate(@degrees);
  302. -ms-transform: rotate(@degrees);
  303. -o-transform: rotate(@degrees);
  304. transform: rotate(@degrees);
  305. }
  306. .scale(@ratio) {
  307. -webkit-transform: scale(@ratio);
  308. -moz-transform: scale(@ratio);
  309. -ms-transform: scale(@ratio);
  310. -o-transform: scale(@ratio);
  311. transform: scale(@ratio);
  312. }
  313. .translate(@x: 0, @y: 0) {
  314. -webkit-transform: translate(@x, @y);
  315. -moz-transform: translate(@x, @y);
  316. -ms-transform: translate(@x, @y);
  317. -o-transform: translate(@x, @y);
  318. transform: translate(@x, @y);
  319. }
  320. .skew(@x: 0, @y: 0) {
  321. -webkit-transform: skew(@x, @y);
  322. -moz-transform: skew(@x, @y);
  323. -ms-transform: skew(@x, @y);
  324. -o-transform: skew(@x, @y);
  325. transform: skew(@x, @y);
  326. }
  327. .translate3d(@x: 0, @y: 0, @z: 0) {
  328. -webkit-transform: translate(@x, @y, @z);
  329. -moz-transform: translate(@x, @y, @z);
  330. -ms-transform: translate(@x, @y, @z);
  331. -o-transform: translate(@x, @y, @z);
  332. transform: translate(@x, @y, @z);
  333. }
  334. // Background clipping
  335. // Heads up: FF 3.6 and under need "padding" instead of "padding-box"
  336. .background-clip(@clip) {
  337. -webkit-background-clip: @clip;
  338. -moz-background-clip: @clip;
  339. background-clip: @clip;
  340. }
  341. // Background sizing
  342. .background-size(@size){
  343. -webkit-background-size: @size;
  344. -moz-background-size: @size;
  345. -o-background-size: @size;
  346. background-size: @size;
  347. }
  348. // Box sizing
  349. .box-sizing(@boxmodel) {
  350. -webkit-box-sizing: @boxmodel;
  351. -moz-box-sizing: @boxmodel;
  352. box-sizing: @boxmodel;
  353. }
  354. // User select
  355. // For selecting text on the page
  356. .user-select(@select) {
  357. -webkit-user-select: @select;
  358. -moz-user-select: @select;
  359. -o-user-select: @select;
  360. user-select: @select;
  361. }
  362. // Resize anything
  363. .resizable(@direction: both) {
  364. resize: @direction; // Options: horizontal, vertical, both
  365. overflow: auto; // Safari fix
  366. }
  367. // CSS3 Content Columns
  368. .content-columns(@columnCount, @columnGap: @gridColumnGutter) {
  369. -webkit-column-count: @columnCount;
  370. -moz-column-count: @columnCount;
  371. column-count: @columnCount;
  372. -webkit-column-gap: @columnGap;
  373. -moz-column-gap: @columnGap;
  374. column-gap: @columnGap;
  375. }
  376. // Opacity
  377. .opacity(@opacity: 100) {
  378. opacity: @opacity / 100;
  379. filter: e(%("alpha(opacity=%d)", @opacity));
  380. }
  381. // BACKGROUNDS
  382. // --------------------------------------------------
  383. // Add an alphatransparency value to any background or border color (via Elyse Holladay)
  384. #translucent {
  385. .background(@color: @white, @alpha: 1) {
  386. background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
  387. }
  388. .border(@color: @white, @alpha: 1) {
  389. border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
  390. .background-clip(padding-box);
  391. }
  392. }
  393. // Gradient Bar Colors for buttons and alerts
  394. .gradientBar(@primaryColor, @secondaryColor) {
  395. #gradient > .vertical(@primaryColor, @secondaryColor);
  396. border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
  397. border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
  398. }
  399. // Gradients
  400. #gradient {
  401. .horizontal(@startColor: #555, @endColor: #333) {
  402. background-color: @endColor;
  403. background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
  404. background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
  405. background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
  406. background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  407. background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
  408. background-image: linear-gradient(left, @startColor, @endColor); // Le standard
  409. background-repeat: repeat-x;
  410. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down
  411. }
  412. .vertical(@startColor: #555, @endColor: #333) {
  413. background-color: mix(@startColor, @endColor, 60%);
  414. background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
  415. background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
  416. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
  417. background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  418. background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
  419. background-image: linear-gradient(top, @startColor, @endColor); // The standard
  420. background-repeat: repeat-x;
  421. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down
  422. }
  423. .directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
  424. background-color: @endColor;
  425. background-repeat: repeat-x;
  426. background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
  427. background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10
  428. background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  429. background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
  430. background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
  431. }
  432. .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
  433. background-color: mix(@midColor, @endColor, 80%);
  434. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
  435. background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  436. background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
  437. background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  438. background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  439. background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
  440. background-repeat: no-repeat;
  441. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down, gets no color-stop at all for proper fallback
  442. }
  443. .radial(@innerColor: #555, @outerColor: #333) {
  444. background-color: @outerColor;
  445. background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor));
  446. background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor);
  447. background-image: -moz-radial-gradient(circle, @innerColor, @outerColor);
  448. background-image: -ms-radial-gradient(circle, @innerColor, @outerColor);
  449. background-repeat: no-repeat;
  450. // Opera cannot do radial gradients yet
  451. }
  452. .striped(@color, @angle: -45deg) {
  453. background-color: @color;
  454. background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent));
  455. background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
  456. background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
  457. background-image: -ms-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
  458. background-image: -o-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
  459. background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
  460. }
  461. }
  462. // Reset filters for IE
  463. .reset-filter() {
  464. filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
  465. }
  466. // Mixin for generating button backgrounds
  467. // ---------------------------------------
  468. .buttonBackground(@startColor, @endColor) {
  469. // gradientBar will set the background to a pleasing blend of these, to support IE<=9
  470. .gradientBar(@startColor, @endColor);
  471. .reset-filter();
  472. // in these cases the gradient won't cover the background, so we override
  473. &:hover, &:active, &.active, &.disabled, &[disabled] {
  474. background-color: @endColor;
  475. }
  476. // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
  477. &:active,
  478. &.active {
  479. background-color: darken(@endColor, 10%) e("\9");
  480. }
  481. }
  482. // COMPONENT MIXINS
  483. // --------------------------------------------------
  484. // POPOVER ARROWS
  485. // -------------------------
  486. // For tipsies and popovers
  487. #popoverArrow {
  488. .top(@arrowWidth: 5px) {
  489. bottom: 0;
  490. left: 50%;
  491. margin-left: -@arrowWidth;
  492. border-left: @arrowWidth solid transparent;
  493. border-right: @arrowWidth solid transparent;
  494. border-top: @arrowWidth solid @black;
  495. }
  496. .left(@arrowWidth: 5px) {
  497. top: 50%;
  498. right: 0;
  499. margin-top: -@arrowWidth;
  500. border-top: @arrowWidth solid transparent;
  501. border-bottom: @arrowWidth solid transparent;
  502. border-left: @arrowWidth solid @black;
  503. }
  504. .bottom(@arrowWidth: 5px) {
  505. top: 0;
  506. left: 50%;
  507. margin-left: -@arrowWidth;
  508. border-left: @arrowWidth solid transparent;
  509. border-right: @arrowWidth solid transparent;
  510. border-bottom: @arrowWidth solid @black;
  511. }
  512. .right(@arrowWidth: 5px) {
  513. top: 50%;
  514. left: 0;
  515. margin-top: -@arrowWidth;
  516. border-top: @arrowWidth solid transparent;
  517. border-bottom: @arrowWidth solid transparent;
  518. border-right: @arrowWidth solid @black;
  519. }
  520. }