You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  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. @color-rgba: rgba(red(@border-color), green(@border-color), blue(@border-color), .2);
  25. border-color: darken(@border-color, 10%);
  26. @shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 0 4px @color-rgba;
  27. .box-shadow(@shadow);
  28. }
  29. }
  30. // Set validation states also for addons
  31. .input-group-addon {
  32. color: @text-color;
  33. background-color: @background-color;
  34. border-color: @border-color;
  35. }
  36. // Optional feedback icon
  37. .form-control-feedback {
  38. color: @text-color;
  39. }
  40. }
  41. // Form control focus state
  42. //
  43. // Generate a customized focus state and for any input with the specified color,
  44. // which defaults to the `@input-border-focus` variable.
  45. //
  46. // We highly encourage you to not customize the default value, but instead use
  47. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  48. // WebKit's default styles, but applicable to a wider range of browsers. Its
  49. // usability and accessibility should be taken into account with any change.
  50. //
  51. // Example usage: change the default blue border and shadow to white for better
  52. // contrast against a dark gray background.
  53. .form-control-focus(@color: @input-border-focus) {
  54. @color-rgba: rgba(red(@color), green(@color), blue(@color), .2);
  55. &:focus {
  56. border-color: @color;
  57. outline: 0;
  58. .box-shadow(~"inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 0 4px @{color-rgba}");
  59. }
  60. }
  61. // Form control sizing
  62. //
  63. // Relative text size, padding, and border-radii changes for form controls. For
  64. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  65. // element gets special love because it's special, and that's a fact!
  66. .input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  67. height: @input-height;
  68. padding: @padding-vertical @padding-horizontal;
  69. font-size: @font-size;
  70. line-height: @line-height;
  71. border-radius: @border-radius;
  72. select& {
  73. height: @input-height;
  74. line-height: @input-height;
  75. }
  76. textarea&,
  77. select[multiple]& {
  78. height: auto;
  79. }
  80. }