CSS填坑代码大全

1. 文字溢出省略号显示

white-space: nowrap; text-overflow: ellipsis; overflow: hidden;

2. 文字换行

/*强制不换行*/
white-space:nowrap;
/*自动换行*/
word-wrap: break-word;
word-break: normal;
/*强制英文单词断行*/
word-break:break-all;

3. 画三角形

width: 0; 
height: 0; 
border-style: solid; 
border-width: 0 100px 100px 100px; 
border-color: transparent transparent #f00 transparent;

4. 强制出现滚动条

html{  height: 101%;}

5. 清除浮动

.clearfix{*zoom: 1;}
.clearfix{overflow:hidden;_zoom:1;}
.clearfix:after{clear:both;display:table;content:"”;}

6. 给div实现透明效果,支持ie7+

opacity: 0.5; 
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);

7.去掉Webkit(chrome)浏览器中input(文本框)或textarea的黄色焦点框

input,button,select,textarea{ outline:none;}
textarea{ resize:none;}

8.去掉chrome记住密码后自动填充表单的黄色背景

input : -webkit-autofill {
    background-color : #FAFFBD ;
    background-image : none ;
    color : #000 ;
}

9.min-height: 最小高度兼容代码

min-height:500px;height:auto !important;height:500px;overflow:visible;

10.placeholder占位符颜色自定义

input:-moz-placeholder { color: #369; }

::-webkit-input-placeholder { color:#369; }

11.焦点去除背景

-webkit-tap-highlight-color: rgba(255, 255, 255, 0);

-webkit-tap-highlight-color: transparent;  
// i.e. Nexus5/Chrome and Kindle Fire HD 7

12.手机版本网页a标记虚线框问题

a:focus { outline:none; -moz-outline:none; }

13.输入框聚焦发光效果

input[type=text],
textarea{
     -webkit-transition: all 0.30s ease-in-out;
     -moz-transition: all 0.30s ease-in-out;
     -ms-transition: all 0.30s ease-in-out;
     -o-transition: all 0.30s ease-in-out;
     outline: none;
     border: 1px solid #ddd;
}

input[type=text]:focus, 
textarea:focus {
    box-shadow: 0 0 5px rgba(81, 203, 238, 1);
    border: 1px solid rgba(81, 203, 238, 1);
}

转载于:https://my.oschina.net/oschinaindex/blog/514351

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值