mixins.less
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
.setPlaceholder(@prefix,@color:@text-color-help-dark) {
// input
@{prefix}::-webkit-input-placeholder {
color: @color;
}
@{prefix}::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: @color;
}
@{prefix}:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: @color;
}
@{prefix}:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: @color;
}
}
// 文本截断
.text-truncate() {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 强制不换行 */
.word-nowrap() {
word-wrap: normal;
white-space: nowrap;
}
/* 强制换行 */
.break-all() {
word-break: break-all;
word-wrap: break-word;
white-space: normal;
}
// 禁止选中
.unselect() {
cursor: pointer;
user-select: none;
}
/* 适用于webkit内核和移动端 */
.ellipsis-multiple(@num: 1) {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: @num;
}
.respond-to (small, @content) {
@media only screen and (min-width: @screen-sm-min) {
@content();
}
}
.respond-to (medium, @content) {
@media only screen and (min-width: @screen-md-min) {
@content();
}
}
.respond-to (large, @content) {
@media only screen and (min-width: @screen-lg-min) {
@content();
}
}
.respond-to (xlarge, @content) {
@media only screen and (min-width: @screen-xl-min) {
@content();
}
}
.respond-to (xsmall-only, @content) {
@media only screen and (max-width: @screen-xs-max) {
@content();
}
}
.respond-to (small-only, @content) {
@media only screen and (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
@content();
}
}
.respond-to (medium-only, @content) {
@media only screen and (min-width: @screen-md-min) and (max-width: @screen-md-max) {
@content();
}
}
.respond-to (large-only, @content) {
@media only screen and (min-width: @screen-lg-min) and (max-width: @screen-lg-max) {
@content();
}
}
.respond-to (xsmall-and-small, @content) {
@media only screen and (max-width: @screen-sm-max) {
@content();
}
}
.respond-to (small-and-medium, @content) {
@media only screen and (min-width: @screen-sm-min) and (max-width: @screen-md-max) {
@content();
}
}