mixins.less 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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 #333;
  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. // Make a Grid
  248. // -------------------------
  249. // Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
  250. .makeRow() {
  251. margin-left: @gridGutterWidth * -1;
  252. .clearfix();
  253. }
  254. .makeColumn(@columns: 1) {
  255. float: left;
  256. margin-left: @gridGutterWidth;
  257. width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
  258. }
  259. // Form field states (used in forms.less)
  260. // --------------------------------------------------
  261. // Mixin for form field states
  262. .formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) {
  263. // Set the text color
  264. > label,
  265. .help-block,
  266. .help-inline {
  267. color: @textColor;
  268. }
  269. // Style inputs accordingly
  270. input,
  271. select,
  272. textarea {
  273. color: @textColor;
  274. border-color: @borderColor;
  275. &:focus {
  276. border-color: darken(@borderColor, 10%);
  277. .box-shadow(0 0 6px lighten(@borderColor, 20%));
  278. }
  279. }
  280. // Give a small background color for input-prepend/-append
  281. .input-prepend .add-on,
  282. .input-append .add-on {
  283. color: @textColor;
  284. background-color: @backgroundColor;
  285. border-color: @textColor;
  286. }
  287. }
  288. // CSS3 PROPERTIES
  289. // --------------------------------------------------
  290. // Border Radius
  291. .border-radius(@radius: 5px) {
  292. -webkit-border-radius: @radius;
  293. -moz-border-radius: @radius;
  294. border-radius: @radius;
  295. }
  296. // Drop shadows
  297. .box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
  298. -webkit-box-shadow: @shadow;
  299. -moz-box-shadow: @shadow;
  300. box-shadow: @shadow;
  301. }
  302. // Transitions
  303. .transition(@transition) {
  304. -webkit-transition: @transition;
  305. -moz-transition: @transition;
  306. -ms-transition: @transition;
  307. -o-transition: @transition;
  308. transition: @transition;
  309. }
  310. // Transformations
  311. .rotate(@degrees) {
  312. -webkit-transform: rotate(@degrees);
  313. -moz-transform: rotate(@degrees);
  314. -ms-transform: rotate(@degrees);
  315. -o-transform: rotate(@degrees);
  316. transform: rotate(@degrees);
  317. }
  318. .scale(@ratio) {
  319. -webkit-transform: scale(@ratio);
  320. -moz-transform: scale(@ratio);
  321. -ms-transform: scale(@ratio);
  322. -o-transform: scale(@ratio);
  323. transform: scale(@ratio);
  324. }
  325. .translate(@x: 0, @y: 0) {
  326. -webkit-transform: translate(@x, @y);
  327. -moz-transform: translate(@x, @y);
  328. -ms-transform: translate(@x, @y);
  329. -o-transform: translate(@x, @y);
  330. transform: translate(@x, @y);
  331. }
  332. .skew(@x: 0, @y: 0) {
  333. -webkit-transform: skew(@x, @y);
  334. -moz-transform: skew(@x, @y);
  335. -ms-transform: skew(@x, @y);
  336. -o-transform: skew(@x, @y);
  337. transform: skew(@x, @y);
  338. }
  339. .translate3d(@x: 0, @y: 0, @z: 0) {
  340. -webkit-transform: translate(@x, @y, @z);
  341. -moz-transform: translate(@x, @y, @z);
  342. -ms-transform: translate(@x, @y, @z);
  343. -o-transform: translate(@x, @y, @z);
  344. transform: translate(@x, @y, @z);
  345. }
  346. // Background clipping
  347. // Heads up: FF 3.6 and under need "padding" instead of "padding-box"
  348. .background-clip(@clip) {
  349. -webkit-background-clip: @clip;
  350. -moz-background-clip: @clip;
  351. background-clip: @clip;
  352. }
  353. // Background sizing
  354. .background-size(@size){
  355. -webkit-background-size: @size;
  356. -moz-background-size: @size;
  357. -o-background-size: @size;
  358. background-size: @size;
  359. }
  360. // Box sizing
  361. .box-sizing(@boxmodel) {
  362. -webkit-box-sizing: @boxmodel;
  363. -moz-box-sizing: @boxmodel;
  364. box-sizing: @boxmodel;
  365. }
  366. // User select
  367. // For selecting text on the page
  368. .user-select(@select) {
  369. -webkit-user-select: @select;
  370. -moz-user-select: @select;
  371. -o-user-select: @select;
  372. user-select: @select;
  373. }
  374. // Resize anything
  375. .resizable(@direction: both) {
  376. resize: @direction; // Options: horizontal, vertical, both
  377. overflow: auto; // Safari fix
  378. }
  379. // CSS3 Content Columns
  380. .content-columns(@columnCount, @columnGap: @gridColumnGutter) {
  381. -webkit-column-count: @columnCount;
  382. -moz-column-count: @columnCount;
  383. column-count: @columnCount;
  384. -webkit-column-gap: @columnGap;
  385. -moz-column-gap: @columnGap;
  386. column-gap: @columnGap;
  387. }
  388. // Opacity
  389. .opacity(@opacity: 100) {
  390. opacity: @opacity / 100;
  391. filter: e(%("alpha(opacity=%d)", @opacity));
  392. }
  393. // BACKGROUNDS
  394. // --------------------------------------------------
  395. // Add an alphatransparency value to any background or border color (via Elyse Holladay)
  396. #translucent {
  397. .background(@color: @white, @alpha: 1) {
  398. background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
  399. }
  400. .border(@color: @white, @alpha: 1) {
  401. border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
  402. .background-clip(padding-box);
  403. }
  404. }
  405. // Gradient Bar Colors for buttons and alerts
  406. .gradientBar(@primaryColor, @secondaryColor) {
  407. #gradient > .vertical(@primaryColor, @secondaryColor);
  408. border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
  409. border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
  410. }
  411. // Gradients
  412. #gradient {
  413. .horizontal(@startColor: #555, @endColor: #333) {
  414. background-color: @endColor;
  415. background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
  416. background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
  417. background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
  418. background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  419. background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
  420. background-image: linear-gradient(left, @startColor, @endColor); // Le standard
  421. background-repeat: repeat-x;
  422. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down
  423. }
  424. .vertical(@startColor: #555, @endColor: #333) {
  425. background-color: mix(@startColor, @endColor, 60%);
  426. background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
  427. background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10
  428. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
  429. background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  430. background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
  431. background-image: linear-gradient(top, @startColor, @endColor); // The standard
  432. background-repeat: repeat-x;
  433. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down
  434. }
  435. .directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
  436. background-color: @endColor;
  437. background-repeat: repeat-x;
  438. background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
  439. background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10
  440. background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  441. background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
  442. background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
  443. }
  444. .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
  445. background-color: mix(@midColor, @endColor, 80%);
  446. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
  447. background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  448. background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
  449. background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  450. background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
  451. background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
  452. background-repeat: no-repeat;
  453. 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
  454. }
  455. .radial(@innerColor: #555, @outerColor: #333) {
  456. background-color: @outerColor;
  457. background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor));
  458. background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor);
  459. background-image: -moz-radial-gradient(circle, @innerColor, @outerColor);
  460. background-image: -ms-radial-gradient(circle, @innerColor, @outerColor);
  461. background-repeat: no-repeat;
  462. // Opera cannot do radial gradients yet
  463. }
  464. .striped(@color, @angle: -45deg) {
  465. background-color: @color;
  466. 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));
  467. 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);
  468. 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);
  469. 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);
  470. 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);
  471. 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);
  472. }
  473. }
  474. // Reset filters for IE
  475. .reset-filter() {
  476. filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
  477. }
  478. // Mixin for generating button backgrounds
  479. // ---------------------------------------
  480. .buttonBackground(@startColor, @endColor) {
  481. // gradientBar will set the background to a pleasing blend of these, to support IE<=9
  482. .gradientBar(@startColor, @endColor);
  483. .reset-filter();
  484. // in these cases the gradient won't cover the background, so we override
  485. &:hover, &:active, &.active, &.disabled, &[disabled] {
  486. background-color: @endColor;
  487. }
  488. // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
  489. &:active,
  490. &.active {
  491. background-color: darken(@endColor, 10%) e("\9");
  492. }
  493. }
  494. // COMPONENT MIXINS
  495. // --------------------------------------------------
  496. // POPOVER ARROWS
  497. // -------------------------
  498. // For tipsies and popovers
  499. #popoverArrow {
  500. .top(@arrowWidth: 5px) {
  501. bottom: 0;
  502. left: 50%;
  503. margin-left: -@arrowWidth;
  504. border-left: @arrowWidth solid transparent;
  505. border-right: @arrowWidth solid transparent;
  506. border-top: @arrowWidth solid @black;
  507. }
  508. .left(@arrowWidth: 5px) {
  509. top: 50%;
  510. right: 0;
  511. margin-top: -@arrowWidth;
  512. border-top: @arrowWidth solid transparent;
  513. border-bottom: @arrowWidth solid transparent;
  514. border-left: @arrowWidth solid @black;
  515. }
  516. .bottom(@arrowWidth: 5px) {
  517. top: 0;
  518. left: 50%;
  519. margin-left: -@arrowWidth;
  520. border-left: @arrowWidth solid transparent;
  521. border-right: @arrowWidth solid transparent;
  522. border-bottom: @arrowWidth solid @black;
  523. }
  524. .right(@arrowWidth: 5px) {
  525. top: 50%;
  526. left: 0;
  527. margin-top: -@arrowWidth;
  528. border-top: @arrowWidth solid transparent;
  529. border-bottom: @arrowWidth solid transparent;
  530. border-right: @arrowWidth solid @black;
  531. }
  532. }