forms.less 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: @brand-primary; @border-color: @gray-light; @background-color: @inverse) {
  6. // Color the label and help text
  7. .help-block,
  8. .control-label,
  9. .radio,
  10. .checkbox,
  11. .radio-inline,
  12. .checkbox-inline {
  13. color: @text-color;
  14. }
  15. // Set the border and box shadow on specific inputs to match
  16. .form-control {
  17. color: @text-color;
  18. border-color: @border-color;
  19. box-shadow: none;
  20. .placeholder(@text-color);
  21. &:focus {
  22. border-color: @border-color;
  23. box-shadow: none;
  24. }
  25. }
  26. // Set validation states also for addons
  27. .input-group-addon {
  28. color: @text-color;
  29. border-color: @border-color;
  30. background-color: @background-color;
  31. }
  32. .form-control-feedback {
  33. color: @text-color;
  34. }
  35. }
  36. // Form control focus state
  37. //
  38. // Generate a customized focus state and for any input with the specified color,
  39. // which defaults to the `@input-focus-border` variable.
  40. //
  41. // We highly encourage you to not customize the default value, but instead use
  42. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  43. // WebKit's default styles, but applicable to a wider range of browsers. Its
  44. // usability and accessibility should be taken into account with any change.
  45. //
  46. // Example usage: change the default blue border and shadow to white for better
  47. // contrast against a dark gray background.
  48. .form-control-focus(@color: @brand-secondary) {
  49. .form-group.focus &,
  50. &:focus {
  51. border-color: @color;
  52. outline: 0;
  53. box-shadow: none;
  54. }
  55. }
  56. // Form control sizing
  57. //
  58. // Relative text size, padding, and border-radii changes for form controls. For
  59. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  60. // element gets special love because it's special, and that's a fact!
  61. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius: @border-radius-large) {
  62. height: @input-height;
  63. padding: @padding-vertical @padding-horizontal;
  64. font-size: @font-size;
  65. line-height: @line-height;
  66. border-radius: @border-radius;
  67. select& {
  68. height: @input-height;
  69. line-height: @input-height;
  70. }
  71. textarea&,
  72. select[multiple]& {
  73. height: auto;
  74. }
  75. }
  76. // Reset rounded corners for form controls
  77. //
  78. .form-controls-corners-reset() {
  79. .input-group .form-control:first-child,
  80. .input-group-addon:first-child,
  81. .input-group-btn:first-child > .btn,
  82. .input-group-btn:first-child > .dropdown-toggle,
  83. .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
  84. .border-right-radius(0);
  85. }
  86. .input-group .form-control:last-child,
  87. .input-group-addon:last-child,
  88. .input-group-btn:last-child > .btn,
  89. .input-group-btn:last-child > .dropdown-toggle,
  90. .input-group-btn:first-child > .btn:not(:first-child) {
  91. .border-left-radius(0);
  92. }
  93. }