• 记录不常用的css效果


    1.清除浮动:

    .clearfloat:after{display:block;clear:both;content:"";visibility:hidden;height:0}
    .clearfloat{zoom:1;}


    2.设置背景透明,字体不透明:

    background:rgba(221,172,106,0.6) none repeat scroll !important; filter:Alpha(opacity=60)


    3.三角形箭头

    /*向上箭头,类似A,只有三个边,不能指定上边框*/
    .arrow-up { 0px; height: 0px; border-left: 30px solid transparent; border-right: 30px solid transparent; border-bottom: 30px solid yellow; /*以下属性可以是IE5兼容*/ font-size: 0px; line-height: 0px; } 
    /*向下箭头 ,类似 V*/
    .arrow-down { 0px; height: 0px; border-left: 30px solid transparent; border-right: 30px solid transparent; border-top: 30px solid blue; font-size: 0px; line-height: 0px; } /*向左的箭头:只有三个边:上,下,右。而<|总体来看,向左三角形的高=上+下边框的长度。宽=右边框的长度*/
    div.arrow-left { 0px; height: 0px; border-bottom: 30px solid transparent; border-top: 30px solid transparent; border-right: 40px solid green; font-size: 0px; line-height: 0px; } /*向右的箭头:只有三个边:上,下,左。而|>总体来看,向右三角形的高=上+下边框的长度。宽=左边框的长度*/
    div.arrow-right { 0px; height: 0px; border-top: 30px solid transparent; border-bottom: 30px solid transparent; border-left: 60px solid black; font-size: 0px; line-height: 0px; }


    4.图片垂直居中

    4.1外部div的css:
    dvi{ 100%; height:100%; line-height:100%; text-align:center; }
    div img{ vertical-align: middle; }
    4.2
    div{border:1px #ddd solid;208px;height:148px;overflow:hidden;text-align:center;display:table;float:left;margin:50px;position:relative;}
    div span{display:table-cell;vertical-align:middle;}
    div span img{border:1px #ddd solid;margin:0 auto;max-200px;max-height:140px;}


    5.字与字之间的间隔

    .div{ letter-spacing:2px; }


    6.textarea禁止拉伸

    textarea{ resize:none;}


    7.首行缩进

    p{ text-indent:0; }


    8.
    超过一行用省略号

    p{ 1000px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }


    超过两行用省略号

    p{ 
        100%;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
        -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
        -webkit-line-clamp: 2; /** 显示的行数 **/
        overflow: hidden; 
    }


    9.ios系统中按钮样式清除:

    .btn{ -webkit-appearance : none ; }

    11.英文字母大小写

    text-transform:capitalize; //首字母大写
    uppercase; //全大写
    lowercase; //全小写

    12.table外边框颜色

    table{
       100%;
      margin-top: 40px;
      border-color:#eeeeee;
      border: solid thin #eeeeee;
    }

    13.图片变灰

    .gray { 
      -webkit-filter: grayscale(100%);
      -moz-filter: grayscale(100%);
      -ms-filter: grayscale(100%);
      -o-filter: grayscale(100%);
      filter: grayscale(100%);
      filter: gray;
    }

    14.数字太长 不会自动换行怎么办

    p{
        word-break:break-all;
    }

    15.placeholder字体颜色

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

    16.css3渐变

    transition-duration: 0.5s;
    -webkit-transition-duration: 0.5s;
    -ms-transition-duration: 0.5s;
    -o-transition-duration: 0.5s;
    transition-property: opacity;
    -webkit-transition-property: opacity;
    -ms-transition-property: opacity;
    -o-transition-property: opacity;
  • 相关阅读:
    微信公众号开发问题总结(坑)
    map 取值报空指针,明明值存在
    关于客户端Socket连接服务端,客户端只有在服务端关闭后才收到数据的问题
    关于Spine动画,关于cocosCreator
    cocsoCreator实现镜头跟随节点移动
    cocos节点添加Touch监听代码
    使用git管理你的代码,使用git托管代码至gitee
    关于ccoosCreator里的物理系统
    Python Scrapy 爬虫简单教程
    quasar 参考文档
  • 原文地址:https://www.cnblogs.com/wylj/p/9473624.html
Copyright © 2020-2023  润新知