常用css样式

195 阅读1分钟

1.线性渐变

background: -webkit-linear-gradient(left, red , blue); /* Safari 5.1 - 6.0 */
background: linear-gradient(left, red , blue);

2.解决 input 默认黄色

input[type="text"]:-webkit-autofill,input[type="password"]:-webkit-autofill{
         //background: #fff !important;
         -webkit-box-shadow:0 0 0px 1000px white inset;
 }

3.文本溢出

//文本单行溢出
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;

//这里数字代表的是超过几行省略 
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;

4.css写箭头

元素{
	width: 7px;
	height: 7px; 
	border-top: 2px solid #ffffff; 
	border-right: 2px solid #ffffff; 
	transform: rotate(45deg);
	}

5.隐藏滚动条

/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none;
}

6.左右滑动自适应 css

.top_title{
    display: -webkit-box;
    overflow-x: auto;
    /*适应苹果*/
    -webkit-overflow-scrolling:touch;
}
.top_title::-webkit-scrollbar {
    display: none;
}

子元素宽度 大于 父元素 150%+

7.让div根据内容改变大小

div{ 
	width:auto; display:inline-block !important; display:inline;
 }