common.less 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. html{
  2. background: #f1f1f1;
  3. }
  4. body {
  5. font-family: "Helvetica";
  6. margin: 0;
  7. .textColor();
  8. .fontSize();
  9. }
  10. img {
  11. width: 100%;
  12. height: auto;
  13. vertical-align: middle;
  14. }
  15. p {
  16. margin-block-start: 0;
  17. margin-block-end: 0;
  18. }
  19. .icon-default {
  20. width: 20px;
  21. height: 20px;
  22. }
  23. .floatLeft {
  24. float: left;
  25. }
  26. .floatRight {
  27. float: right;
  28. }
  29. .clearfix {
  30. clear: both;
  31. overflow: hidden;
  32. _zoom: 1;
  33. }
  34. .ellipsis {
  35. overflow: hidden;
  36. white-space: nowrap;
  37. text-overflow: ellipsis;
  38. }
  39. .ellipsis-2 {
  40. display: -webkit-box;
  41. overflow: hidden;
  42. white-space: normal !important;
  43. text-overflow: ellipsis;
  44. word-wrap: break-word;
  45. -webkit-line-clamp: 2;
  46. -webkit-box-orient: vertical;
  47. }
  48. button::after {
  49. border: 0;
  50. }
  51. //按钮基本
  52. .butDefault(@bg: #2baa03) {
  53. color: #fff;
  54. border: 1px solid @bg;
  55. background-color: @bg;
  56. }
  57. //按钮激活
  58. .butDefaultActive(@bd: 1px solid rgba(43, 170, 3, .6), @bg: rgba(43, 170, 3, .6)) {
  59. color: #fff;
  60. border: @bd;
  61. background-color: @bg;
  62. }
  63. //文本色
  64. .textColor(@tc: #666) {
  65. color: @tc;
  66. }
  67. //边框色
  68. .borderColor(@bd: #ebedf0) {
  69. border-color: @bd;
  70. }
  71. //边框色文本色
  72. .borderTextColor(@btc: #f44) {
  73. color: @btc;
  74. border-color: @btc;
  75. }
  76. //背景色
  77. .backgroundColor(@bg: #ebedf0) {
  78. background-color: @bg
  79. }
  80. //背景线性渐变从左到右
  81. .backgroundLiearGraientLR(@fc, @tc) {
  82. background: -webkit-linear-gradient(left, @fc, @tc);
  83. /* Safari 5.1 - 6.0 */
  84. background: -o-linear-gradient(right, @fc, @tc);
  85. /* Opera 11.1 - 12.0 */
  86. background: -moz-linear-gradient(right, @fc, @tc);
  87. /* Firefox 3.6 - 15 */
  88. background: linear-gradient(right, @fc, @tc);
  89. /* 标准的语法(必须放在最后) */
  90. }
  91. //背景线性渐变从上到下
  92. .backgroundLiearGraientTB(@fc, @tc) {
  93. background: -webkit-linear-gradient(top, @fc, @tc);
  94. /* Safari 5.1 - 6.0 */
  95. background: -o-linear-gradient(bottom, @fc, @tc);
  96. /* Opera 11.1 - 12.0 */
  97. background: -moz-linear-gradient(bottom, @fc, @tc);
  98. /* Firefox 3.6 - 15 */
  99. background: linear-gradient(bottom, @fc, @tc);
  100. /* 标准的语法(必须放在最后) */
  101. }
  102. //宽高
  103. .wh(@w: 100%, @h: 100%) {
  104. width: @w;
  105. height: @h;
  106. }
  107. //字号
  108. .fontSize(@size: 14px) {
  109. font-size: @size
  110. }
  111. // 背景图片地址和大小
  112. .bis(@url) {
  113. background-image: url(@url);
  114. background-repeat: no-repeat;
  115. background-size: 100% 100%;
  116. }
  117. .borderRadius(@radius) {
  118. -webkit-border-radius: @radius;
  119. -moz-border-radius: @radius;
  120. -ms-border-radius: @radius;
  121. -o-border-radius: @radius;
  122. border-radius: @radius;
  123. }
  124. //背景线条
  125. .backgroundLine(@left: 15px, @right: 0, @height: 1px) {
  126. position: absolute;
  127. content: '';
  128. left: @left;
  129. right: @right;
  130. bottom: 0;
  131. height: @height;
  132. transform: scaleY(.5);
  133. overflow: hidden;
  134. .backgroundColor();
  135. }
  136. //定位上下左右居中
  137. .center {
  138. position: absolute;
  139. top: 50%;
  140. left: 50%;
  141. transform: translate(-50%, -50%);
  142. }
  143. //定位上下居中
  144. .ct {
  145. position: absolute;
  146. top: 50%;
  147. transform: translateY(-50%);
  148. }
  149. //定位左右居中
  150. .cl {
  151. position: absolute;
  152. left: 50%;
  153. transform: translateX(-50%);
  154. }
  155. //字体大小、行高、字体
  156. .font(@size, @line-height, @family: 'Helvetica') {
  157. font: @size/@line-height @family;
  158. }
  159. //字体大小,颜色
  160. .sc(@size, @color) {
  161. font-size: @size;
  162. color: @color;
  163. }
  164. //flex 布局和 子元素 对其方式
  165. .fj(@type: space-between) {
  166. display: flex;
  167. justify-content: @type;
  168. }