CSS日常随笔

记录:

一、多余省略号写法种类

单行省略号写法

@mixin ellipsis($width:200) {
	width: $width;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

多行省略号写法

@mixin ellipsisBasic($clamp:2) {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: $clamp;
}

sass@mixin合集写法

@mixin textOverFlow ($num:1) {
    @if($num==1) {
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
    @else {
        overflow:hidden; 
        text-overflow:ellipsis;
        display:-webkit-box; 
        -webkit-box-orient:vertical;
        -webkit-line-clamp:$num;
    }
}

二、自动生成多后缀

@mixin prefix($declarations, $prefixes: ()) {
    @each $property,$value in $declarations {
        @each $prefix in $prefixes {
            #{'-' + $prefix + '-' + $property}: $value;
        }
        #{$property}: $value;
    }
}

使用方式

@include prefix((transition: left 0.3s), webkit moz o);

二、动画写法animation

@-webkit-keyframes flash {
    25%,
    75% {
        box-shadow: 0 0 3px #ffa800
    }
    0%,
    50%,
    100% {
        box-shadow: none
    }
}

@keyframes flash {
    25%,
    75% {
        box-shadow: 0 0 3px #ffa800
    }
    0%,
    50%,
    100% {
        box-shadow: none
    }
}

使用方式

-webkit-animation: flash 1.1s infinite linear;
animation: flash 1.1s infinite linear;

三、一些问题的小技巧解决方法

swipe轮播图设置了圆角,滑动时会变成直角再回到圆角(iosBug)

在父元素上加

overflow:hidden;
transform:translateY(0)

给元素加1px边框,在移动端可能会消失问题

transform: rotateZ(360deg);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值