一些css常用的css技巧


移动端1px实现的方法

.border-1px{

position:relative;

}

.border-1px:after{

content:'';

position:absolute;

left:0;

bottom:0;

right:auto;

top:auto;

height:1px;

width:100%;

background-color:#666;

display:block;

z-index:15;

-webkit-transform-origin:50% 100%;

transform-origin:50% 100%;

}

@mediaonly screen and (-webkit-min-device-pixel-ratio:2) {

.border-1px:after{

-webkit-transform:scaleY(0.5);

transform:scaleY(0.5);

}

}

@mediaonly screen and (-webkit-min-device-pixel-ratio:3) {

.border-1px:after{

-webkit-transform:scaleY(0.33);

transform:scaleY(0.33);

}

}

2.多行省略(以2行为例)

%twoellipsis{

overflow:hidden;

text-overflow:ellipsis;

display:-webkit-box;

-webkit-line-clamp:2;

-webkit-box-orient:vertical;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容