html{ background: #f1f1f1; } body { font-family: "Helvetica"; margin: 0; .textColor(); .fontSize(); } img { width: 100%; height: auto; vertical-align: middle; } p { margin-block-start: 0; margin-block-end: 0; } .icon-default { width: 20px; height: 20px; } .floatLeft { float: left; } .floatRight { float: right; } .clearfix { clear: both; overflow: hidden; _zoom: 1; } .ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .ellipsis-2 { display: -webkit-box; overflow: hidden; white-space: normal !important; text-overflow: ellipsis; word-wrap: break-word; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } button::after { border: 0; } //按钮基本 .butDefault(@bg: #2baa03) { color: #fff; border: 1px solid @bg; background-color: @bg; } //按钮激活 .butDefaultActive(@bd: 1px solid rgba(43, 170, 3, .6), @bg: rgba(43, 170, 3, .6)) { color: #fff; border: @bd; background-color: @bg; } //文本色 .textColor(@tc: #666) { color: @tc; } //边框色 .borderColor(@bd: #ebedf0) { border-color: @bd; } //边框色文本色 .borderTextColor(@btc: #f44) { color: @btc; border-color: @btc; } //背景色 .backgroundColor(@bg: #ebedf0) { background-color: @bg } //背景线性渐变从左到右 .backgroundLiearGraientLR(@fc, @tc) { background: -webkit-linear-gradient(left, @fc, @tc); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(right, @fc, @tc); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(right, @fc, @tc); /* Firefox 3.6 - 15 */ background: linear-gradient(right, @fc, @tc); /* 标准的语法(必须放在最后) */ } //背景线性渐变从上到下 .backgroundLiearGraientTB(@fc, @tc) { background: -webkit-linear-gradient(top, @fc, @tc); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(bottom, @fc, @tc); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(bottom, @fc, @tc); /* Firefox 3.6 - 15 */ background: linear-gradient(bottom, @fc, @tc); /* 标准的语法(必须放在最后) */ } //宽高 .wh(@w: 100%, @h: 100%) { width: @w; height: @h; } //字号 .fontSize(@size: 14px) { font-size: @size } // 背景图片地址和大小 .bis(@url) { background-image: url(@url); background-repeat: no-repeat; background-size: 100% 100%; } .borderRadius(@radius) { -webkit-border-radius: @radius; -moz-border-radius: @radius; -ms-border-radius: @radius; -o-border-radius: @radius; border-radius: @radius; } //背景线条 .backgroundLine(@left: 15px, @right: 0, @height: 1px) { position: absolute; content: ''; left: @left; right: @right; bottom: 0; height: @height; transform: scaleY(.5); overflow: hidden; .backgroundColor(); } //定位上下左右居中 .center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } //定位上下居中 .ct { position: absolute; top: 50%; transform: translateY(-50%); } //定位左右居中 .cl { position: absolute; left: 50%; transform: translateX(-50%); } //字体大小、行高、字体 .font(@size, @line-height, @family: 'Helvetica') { font: @size/@line-height @family; } //字体大小,颜色 .sc(@size, @color) { font-size: @size; color: @color; } //flex 布局和 子元素 对其方式 .fj(@type: space-between) { display: flex; justify-content: @type; }