一些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;

}

你可能感兴趣的:(一些css常用的css技巧)