forms.less 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. color: @text-color;
  14. }
  15. // Set the border and box shadow on specific inputs to match
  16. .form-control {
  17. border-color: @border-color;
  18. .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
  19. &:focus {
  20. border-color: darken(@border-color, 10%);
  21. @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
  22. .box-shadow(@shadow);
  23. }
  24. }
  25. // Set validation states also for addons
  26. .input-group-addon {
  27. color: @text-color;
  28. border-color: @border-color;
  29. background-color: @background-color;
  30. }
  31. // Optional feedback icon
  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-border-focus` 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: @input-border-focus) {
  49. @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
  50. &:focus {
  51. border-color: @color;
  52. outline: 0;
  53. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
  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) {
  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. }