mixins.less 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. //
  2. // Mixins
  3. // --------------------------------------------------
  4. // Utilities
  5. // -------------------------
  6. // Clearfix
  7. // Source: http://nicolasgallagher.com/micro-clearfix-hack/
  8. //
  9. // For modern browsers
  10. // 1. The space content is one way to avoid an Opera bug when the
  11. // contenteditable attribute is included anywhere else in the document.
  12. // Otherwise it causes space to appear at the top and bottom of elements
  13. // that are clearfixed.
  14. // 2. The use of `table` rather than `block` is only necessary if using
  15. // `:before` to contain the top-margins of child elements.
  16. .clearfix() {
  17. &:before,
  18. &:after {
  19. content: " "; /* 1 */
  20. display: table; /* 2 */
  21. }
  22. &:after {
  23. clear: both;
  24. }
  25. }
  26. // Webkit-style focus
  27. .tab-focus() {
  28. // Default
  29. outline: thin dotted #333;
  30. // Webkit
  31. outline: 5px auto -webkit-focus-ring-color;
  32. outline-offset: -2px;
  33. }
  34. // Center-align a block level element
  35. .center-block() {
  36. display: block;
  37. margin-left: auto;
  38. margin-right: auto;
  39. }
  40. // Sizing shortcuts
  41. .size(@width; @height) {
  42. width: @width;
  43. height: @height;
  44. }
  45. .square(@size) {
  46. .size(@size; @size);
  47. }
  48. // Placeholder text
  49. .placeholder(@color: @input-color-placeholder) {
  50. &:-moz-placeholder { color: @color; } // Firefox 4-18
  51. &::-moz-placeholder { color: @color; } // Firefox 19+
  52. &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+
  53. &::-webkit-input-placeholder { color: @color; } // Safari and Chrome
  54. }
  55. // Text overflow
  56. // Requires inline-block or block for proper styling
  57. .text-overflow() {
  58. overflow: hidden;
  59. text-overflow: ellipsis;
  60. white-space: nowrap;
  61. }
  62. // CSS image replacement
  63. // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
  64. .hide-text() {
  65. font: ~"0/0" a;
  66. color: transparent;
  67. text-shadow: none;
  68. background-color: transparent;
  69. border: 0;
  70. }
  71. // CSS3 PROPERTIES
  72. // --------------------------------------------------
  73. // Single side border-radius
  74. .border-top-radius(@radius) {
  75. border-top-right-radius: @radius;
  76. border-top-left-radius: @radius;
  77. }
  78. .border-right-radius(@radius) {
  79. border-bottom-right-radius: @radius;
  80. border-top-right-radius: @radius;
  81. }
  82. .border-bottom-radius(@radius) {
  83. border-bottom-right-radius: @radius;
  84. border-bottom-left-radius: @radius;
  85. }
  86. .border-left-radius(@radius) {
  87. border-bottom-left-radius: @radius;
  88. border-top-left-radius: @radius;
  89. }
  90. // Drop shadows
  91. .box-shadow(@shadow) {
  92. -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
  93. box-shadow: @shadow;
  94. }
  95. // Transitions
  96. .transition(@transition) {
  97. -webkit-transition: @transition;
  98. transition: @transition;
  99. }
  100. .transition-delay(@transition-delay) {
  101. -webkit-transition-delay: @transition-delay;
  102. transition-delay: @transition-delay;
  103. }
  104. .transition-duration(@transition-duration) {
  105. -webkit-transition-duration: @transition-duration;
  106. transition-duration: @transition-duration;
  107. }
  108. .transition-transform(@transition) {
  109. -webkit-transition: -webkit-transform @transition;
  110. -moz-transition: -moz-transform @transition;
  111. -o-transition: -o-transform @transition;
  112. transition: transform @transition;
  113. }
  114. // Transformations
  115. .rotate(@degrees) {
  116. -webkit-transform: rotate(@degrees);
  117. -ms-transform: rotate(@degrees); // IE9+
  118. transform: rotate(@degrees);
  119. }
  120. .scale(@ratio) {
  121. -webkit-transform: scale(@ratio);
  122. -ms-transform: scale(@ratio); // IE9+
  123. transform: scale(@ratio);
  124. }
  125. .translate(@x; @y) {
  126. -webkit-transform: translate(@x, @y);
  127. -ms-transform: translate(@x, @y); // IE9+
  128. transform: translate(@x, @y);
  129. }
  130. .skew(@x; @y) {
  131. -webkit-transform: skew(@x, @y);
  132. -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+
  133. transform: skew(@x, @y);
  134. }
  135. .translate3d(@x; @y; @z) {
  136. -webkit-transform: translate3d(@x, @y, @z);
  137. transform: translate3d(@x, @y, @z);
  138. }
  139. // Backface visibility
  140. // Prevent browsers from flickering when using CSS 3D transforms.
  141. // Default value is `visible`, but can be changed to `hidden`
  142. // See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples
  143. .backface-visibility(@visibility){
  144. -webkit-backface-visibility: @visibility;
  145. -moz-backface-visibility: @visibility;
  146. backface-visibility: @visibility;
  147. }
  148. // Box sizing
  149. .box-sizing(@boxmodel) {
  150. -webkit-box-sizing: @boxmodel;
  151. -moz-box-sizing: @boxmodel;
  152. box-sizing: @boxmodel;
  153. }
  154. // User select
  155. // For selecting text on the page
  156. .user-select(@select) {
  157. -webkit-user-select: @select;
  158. -moz-user-select: @select;
  159. -ms-user-select: @select; // IE10+
  160. -o-user-select: @select;
  161. user-select: @select;
  162. }
  163. // Resize anything
  164. .resizable(@direction) {
  165. resize: @direction; // Options: horizontal, vertical, both
  166. overflow: auto; // Safari fix
  167. }
  168. // CSS3 Content Columns
  169. .content-columns(@column-count; @column-gap: @grid-gutter-width) {
  170. -webkit-column-count: @column-count;
  171. -moz-column-count: @column-count;
  172. column-count: @column-count;
  173. -webkit-column-gap: @column-gap;
  174. -moz-column-gap: @column-gap;
  175. column-gap: @column-gap;
  176. }
  177. // Optional hyphenation
  178. .hyphens(@mode: auto) {
  179. word-wrap: break-word;
  180. -webkit-hyphens: @mode;
  181. -moz-hyphens: @mode;
  182. -ms-hyphens: @mode; // IE10+
  183. -o-hyphens: @mode;
  184. hyphens: @mode;
  185. }
  186. // Opacity
  187. .opacity(@opacity) {
  188. opacity: @opacity;
  189. // IE8 filter
  190. @opacity-ie: (@opacity * 100);
  191. filter: ~"alpha(opacity=@{opacity-ie})";
  192. }
  193. // GRADIENTS
  194. // --------------------------------------------------
  195. #gradient {
  196. // Horizontal gradient, from left to right
  197. //
  198. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  199. // Color stops are not available in IE9 and below.
  200. .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
  201. background-image: -webkit-gradient(linear, @start-percent top, @end-percent top, from(@start-color), to(@end-color)); // Safari 4+, Chrome 2+
  202. background-image: -webkit-linear-gradient(left, color-stop(@start-color @start-percent), color-stop(@end-color @end-percent)); // Safari 5.1+, Chrome 10+
  203. background-image: -moz-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // FF 3.6+
  204. background-image: linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
  205. background-repeat: repeat-x;
  206. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down
  207. }
  208. // Vertical gradient, from top to bottom
  209. //
  210. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  211. // Color stops are not available in IE9 and below.
  212. .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
  213. background-image: -webkit-gradient(linear, left @start-percent, left @end-percent, from(@start-color), to(@end-color)); // Safari 4+, Chrome 2+
  214. background-image: -webkit-linear-gradient(top, @start-color, @start-percent, @end-color, @end-percent); // Safari 5.1+, Chrome 10+
  215. background-image: -moz-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // FF 3.6+
  216. background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
  217. background-repeat: repeat-x;
  218. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down
  219. }
  220. .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {
  221. background-repeat: repeat-x;
  222. background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1+, Chrome 10+
  223. background-image: -moz-linear-gradient(@deg, @start-color, @end-color); // FF 3.6+
  224. background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10
  225. }
  226. .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
  227. background-image: -webkit-gradient(left, linear, 0 0, 0 100%, from(@start-color), color-stop(@color-stop, @mid-color), to(@end-color));
  228. background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);
  229. background-image: -moz-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);
  230. background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);
  231. background-repeat: no-repeat;
  232. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback
  233. }
  234. .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
  235. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@start-color), color-stop(@color-stop, @mid-color), to(@end-color));
  236. background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);
  237. background-image: -moz-linear-gradient(top, @start-color, @mid-color @color-stop, @end-color);
  238. background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);
  239. background-repeat: no-repeat;
  240. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback
  241. }
  242. .radial(@inner-color: #555; @outer-color: #333) {
  243. background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@inner-color), to(@outer-color));
  244. background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);
  245. background-image: -moz-radial-gradient(circle, @inner-color, @outer-color);
  246. background-image: radial-gradient(circle, @inner-color, @outer-color);
  247. background-repeat: no-repeat;
  248. }
  249. .striped(@color: #555; @angle: 45deg) {
  250. 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));
  251. 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);
  252. 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);
  253. 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);
  254. }
  255. }
  256. // Reset filters for IE
  257. //
  258. // When you need to remove a gradient background, do not forget to use this to reset
  259. // the IE filter for IE9 and below.
  260. .reset-filter() {
  261. filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
  262. }
  263. // Retina images
  264. //
  265. // Short retina mixin for setting background-image and -size
  266. .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
  267. background-image: url("@{file-1x}");
  268. @media
  269. only screen and (-webkit-min-device-pixel-ratio: 2),
  270. only screen and ( min--moz-device-pixel-ratio: 2),
  271. only screen and ( -o-min-device-pixel-ratio: 2/1),
  272. only screen and ( min-device-pixel-ratio: 2),
  273. only screen and ( min-resolution: 192dpi),
  274. only screen and ( min-resolution: 2dppx) {
  275. background-image: url("@{file-2x}");
  276. background-size: @width-1x @height-1x;
  277. }
  278. }
  279. // Responsive image
  280. //
  281. // Keep images from scaling beyond the width of their parents.
  282. .img-responsive(@display: block;) {
  283. display: @display;
  284. max-width: 100%; // Part 1: Set a maximum relative to the parent
  285. height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
  286. }
  287. // COMPONENT MIXINS
  288. // --------------------------------------------------
  289. // Horizontal dividers
  290. // -------------------------
  291. // Dividers (basically an hr) within dropdowns and nav lists
  292. .nav-divider(@color: #e5e5e5) {
  293. height: 1px;
  294. margin: ((@line-height-computed / 2) - 1) 0;
  295. overflow: hidden;
  296. background-color: @color;
  297. }
  298. // Panels
  299. // -------------------------
  300. .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border;) {
  301. border-color: @border;
  302. & > .panel-heading {
  303. color: @heading-text-color;
  304. background-color: @heading-bg-color;
  305. border-color: @heading-border;
  306. + .panel-collapse .panel-body {
  307. border-top-color: @border;
  308. }
  309. }
  310. & > .panel-footer {
  311. + .panel-collapse .panel-body {
  312. border-bottom-color: @border;
  313. }
  314. }
  315. }
  316. // Alerts
  317. // -------------------------
  318. .alert-variant(@background; @border; @text-color) {
  319. background-color: @background;
  320. border-color: @border;
  321. color: @text-color;
  322. hr {
  323. border-top-color: darken(@border, 5%);
  324. }
  325. .alert-link {
  326. color: darken(@text-color, 10%);
  327. }
  328. }
  329. // Tables
  330. // -------------------------
  331. .table-row-variant(@state; @background; @border) {
  332. // Exact selectors below required to override `.table-striped` and prevent
  333. // inheritance to nested tables.
  334. .table > thead > tr,
  335. .table > tbody > tr,
  336. .table > tfoot > tr {
  337. > td.@{state},
  338. > th.@{state},
  339. &.@{state} > td,
  340. &.@{state} > th {
  341. background-color: @background;
  342. border-color: @border;
  343. }
  344. }
  345. // Hover states for `.table-hover`
  346. // Note: this is not available for cells or rows within `thead` or `tfoot`.
  347. .table-hover > tbody > tr {
  348. > td.@{state}:hover,
  349. > th.@{state}:hover,
  350. &.@{state}:hover > td {
  351. background-color: darken(@background, 5%);
  352. border-color: darken(@border, 5%);
  353. }
  354. }
  355. }
  356. // Button variants
  357. // -------------------------
  358. // Easily pump out default styles, as well as :hover, :focus, :active,
  359. // and disabled options for all buttons
  360. .button-variant(@color; @background; @border) {
  361. color: @color;
  362. background-color: @background;
  363. border-color: @border;
  364. &:hover,
  365. &:focus,
  366. &:active,
  367. &.active,
  368. .open .dropdown-toggle& {
  369. color: @color;
  370. background-color: darken(@background, 8%);
  371. border-color: darken(@border, 12%);
  372. }
  373. &:active,
  374. &.active,
  375. .open .dropdown-toggle& {
  376. background-image: none;
  377. }
  378. &.disabled,
  379. &[disabled],
  380. fieldset[disabled] & {
  381. &,
  382. &:hover,
  383. &:focus,
  384. &:active,
  385. &.active {
  386. background-color: @background;
  387. border-color: @border
  388. }
  389. }
  390. }
  391. // Button sizes
  392. // -------------------------
  393. .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  394. padding: @padding-vertical @padding-horizontal;
  395. font-size: @font-size;
  396. line-height: @line-height;
  397. border-radius: @border-radius;
  398. }
  399. // Pagination
  400. // -------------------------
  401. .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
  402. > li {
  403. > a,
  404. > span {
  405. padding: @padding-vertical @padding-horizontal;
  406. font-size: @font-size;
  407. }
  408. &:first-child {
  409. > a,
  410. > span {
  411. .border-left-radius(@border-radius);
  412. }
  413. }
  414. &:last-child {
  415. > a,
  416. > span {
  417. .border-right-radius(@border-radius);
  418. }
  419. }
  420. }
  421. }
  422. // Labels
  423. // -------------------------
  424. .label-variant(@color) {
  425. background-color: @color;
  426. &[href] {
  427. &:hover,
  428. &:focus {
  429. background-color: darken(@color, 10%);
  430. }
  431. }
  432. }
  433. // Navbar vertical align
  434. // -------------------------
  435. // Vertically center elements in the navbar.
  436. // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
  437. .navbar-vertical-align(@element-height) {
  438. margin-top: ((@navbar-height - @element-height) / 2);
  439. margin-bottom: ((@navbar-height - @element-height) / 2);
  440. }
  441. // Progress bars
  442. // -------------------------
  443. .progress-bar-variant(@color) {
  444. background-color: @color;
  445. .progress-striped & {
  446. #gradient > .striped(@color);
  447. }
  448. }
  449. // Responsive utilities
  450. // -------------------------
  451. // More easily include all the states for responsive-utilities.less.
  452. .responsive-visibility() {
  453. display: block !important;
  454. tr& { display: table-row !important; }
  455. th&,
  456. td& { display: table-cell !important; }
  457. }
  458. .responsive-invisibility() {
  459. display: none !important;
  460. tr& { display: none !important; }
  461. th&,
  462. td& { display: none !important; }
  463. }
  464. // Grid System
  465. // -----------
  466. // Centered container element
  467. .container-fixed() {
  468. margin-right: auto;
  469. margin-left: auto;
  470. padding-left: (@grid-gutter-width / 2);
  471. padding-right: (@grid-gutter-width / 2);
  472. .clearfix();
  473. }
  474. // Creates a wrapper for a series of columns
  475. .make-row(@gutter: @grid-gutter-width) {
  476. margin-left: (@gutter / -2);
  477. margin-right: (@gutter / -2);
  478. .clearfix();
  479. }
  480. // Generate the extra small columns
  481. .make-xs-column(@columns; @gutter: @grid-gutter-width) {
  482. position: relative;
  483. float: left;
  484. width: percentage((@columns / @grid-columns));
  485. // Prevent columns from collapsing when empty
  486. min-height: 1px;
  487. // Inner gutter via padding
  488. padding-left: (@gutter / 2);
  489. padding-right: (@gutter / 2);
  490. }
  491. // Generate the small columns
  492. .make-sm-column(@columns; @gutter: @grid-gutter-width) {
  493. position: relative;
  494. // Prevent columns from collapsing when empty
  495. min-height: 1px;
  496. // Inner gutter via padding
  497. padding-left: (@gutter / 2);
  498. padding-right: (@gutter / 2);
  499. // Calculate width based on number of columns available
  500. @media (min-width: @screen-sm) {
  501. float: left;
  502. width: percentage((@columns / @grid-columns));
  503. }
  504. }
  505. // Generate the small column offsets
  506. .make-sm-column-offset(@columns) {
  507. @media (min-width: @screen-sm) {
  508. margin-left: percentage((@columns / @grid-columns));
  509. }
  510. }
  511. .make-sm-column-push(@columns) {
  512. @media (min-width: @screen-sm) {
  513. left: percentage((@columns / @grid-columns));
  514. }
  515. }
  516. .make-sm-column-pull(@columns) {
  517. @media (min-width: @screen-sm) {
  518. right: percentage((@columns / @grid-columns));
  519. }
  520. }
  521. // Generate the medium columns
  522. .make-md-column(@columns; @gutter: @grid-gutter-width) {
  523. position: relative;
  524. // Prevent columns from collapsing when empty
  525. min-height: 1px;
  526. // Inner gutter via padding
  527. padding-left: (@gutter / 2);
  528. padding-right: (@gutter / 2);
  529. // Calculate width based on number of columns available
  530. @media (min-width: @screen-md) {
  531. float: left;
  532. width: percentage((@columns / @grid-columns));
  533. }
  534. }
  535. // Generate the large column offsets
  536. .make-md-column-offset(@columns) {
  537. @media (min-width: @screen-md) {
  538. margin-left: percentage((@columns / @grid-columns));
  539. }
  540. }
  541. .make-md-column-push(@columns) {
  542. @media (min-width: @screen-md) {
  543. left: percentage((@columns / @grid-columns));
  544. }
  545. }
  546. .make-md-column-pull(@columns) {
  547. @media (min-width: @screen-md) {
  548. right: percentage((@columns / @grid-columns));
  549. }
  550. }
  551. // Generate the large columns
  552. .make-lg-column(@columns; @gutter: @grid-gutter-width) {
  553. position: relative;
  554. // Prevent columns from collapsing when empty
  555. min-height: 1px;
  556. // Inner gutter via padding
  557. padding-left: (@gutter / 2);
  558. padding-right: (@gutter / 2);
  559. // Calculate width based on number of columns available
  560. @media (min-width: @screen-lg) {
  561. float: left;
  562. width: percentage((@columns / @grid-columns));
  563. }
  564. }
  565. // Generate the large column offsets
  566. .make-lg-column-offset(@columns) {
  567. @media (min-width: @screen-lg) {
  568. margin-left: percentage((@columns / @grid-columns));
  569. }
  570. }
  571. .make-lg-column-push(@columns) {
  572. @media (min-width: @screen-lg) {
  573. left: percentage((@columns / @grid-columns));
  574. }
  575. }
  576. .make-lg-column-pull(@columns) {
  577. @media (min-width: @screen-lg) {
  578. right: percentage((@columns / @grid-columns));
  579. }
  580. }
  581. // Form validation states
  582. //
  583. // Used in forms.less to generate the form validation CSS for warnings, errors,
  584. // and successes.
  585. .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {
  586. // Color the label and help text
  587. .help-block,
  588. .control-label {
  589. color: @text-color;
  590. }
  591. // Set the border and box shadow on specific inputs to match
  592. .form-control {
  593. border-color: @border-color;
  594. .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
  595. &:focus {
  596. border-color: darken(@border-color, 10%);
  597. @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
  598. .box-shadow(@shadow);
  599. }
  600. }
  601. // Set validation states also for addons
  602. .input-group-addon {
  603. color: @text-color;
  604. border-color: @border-color;
  605. background-color: @background-color;
  606. }
  607. }
  608. // Form control focus state
  609. //
  610. // Generate a customized focus state and for any input with the specified color,
  611. // which defaults to the `@input-focus-border` variable.
  612. //
  613. // We highly encourage you to not customize the default value, but instead use
  614. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  615. // WebKit's default styles, but applicable to a wider range of browsers. Its
  616. // usability and accessibility should be taken into account with any change.
  617. //
  618. // Example usage: change the default blue border and shadow to white for better
  619. // contrast against a dark gray background.
  620. .form-control-focus(@color: @input-border-focus) {
  621. @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
  622. &:focus {
  623. border-color: @color;
  624. outline: 0;
  625. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
  626. }
  627. }
  628. // Form control sizing
  629. //
  630. // Relative text size, padding, and border-radii changes for form controls. For
  631. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  632. // element gets special love because it's special, and that's a fact!
  633. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  634. height: @input-height;
  635. padding: @padding-vertical @padding-horizontal;
  636. font-size: @font-size;
  637. line-height: @line-height;
  638. border-radius: @border-radius;
  639. select& {
  640. height: @input-height;
  641. line-height: @input-height;
  642. }
  643. textarea& {
  644. height: auto;
  645. }
  646. }