forms.less 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Form validation states
  2. //
  3. // Used in forms.less to generate the form validation CSS for warnings, errors,
  4. // and successes.
  5. .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {
  6. // Color the label and help text
  7. .help-block,
  8. .control-label,
  9. .radio,
  10. .checkbox,
  11. .radio-inline,
  12. .checkbox-inline,
  13. &.radio label,
  14. &.checkbox label,
  15. &.radio-inline label,
  16. &.checkbox-inline label {
  17. color: @text-color;
  18. }
  19. // Set the border and box shadow on specific inputs to match
  20. .form-control {
  21. border-color: @border-color;
  22. .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
  23. &:focus {
  24. border-color: darken(@border-color, 10%);
  25. @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
  26. .box-shadow(@shadow);
  27. }
  28. }
  29. // Set validation states also for addons
  30. .input-group-addon {
  31. color: @text-color;
  32. border-color: @border-color;
  33. background-color: @background-color;
  34. }
  35. // Optional feedback icon
  36. .form-control-feedback {
  37. color: @text-color;
  38. }
  39. }
  40. // Form control focus state
  41. //
  42. // Generate a customized focus state and for any input with the specified color,
  43. // which defaults to the `@input-border-focus` variable.
  44. //
  45. // We highly encourage you to not customize the default value, but instead use
  46. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  47. // WebKit's default styles, but applicable to a wider range of browsers. Its
  48. // usability and accessibility should be taken into account with any change.
  49. //
  50. // Example usage: change the default blue border and shadow to white for better
  51. // contrast against a dark gray background.
  52. .form-control-focus(@color: @input-border-focus) {
  53. @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
  54. &:focus {
  55. border-color: @color;
  56. outline: 0;
  57. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
  58. }
  59. }
  60. // Form control sizing
  61. //
  62. // Relative text size, padding, and border-radii changes for form controls. For
  63. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  64. // element gets special love because it's special, and that's a fact!
  65. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  66. height: @input-height;
  67. padding: @padding-vertical @padding-horizontal;
  68. font-size: @font-size;
  69. line-height: @line-height;
  70. border-radius: @border-radius;
  71. select& {
  72. height: @input-height;
  73. line-height: @input-height;
  74. }
  75. textarea&,
  76. select[multiple]& {
  77. height: auto;
  78. }
  79. }