zoukankan      html  css  js  c++  java
  • 关于CSS3的一些用法,持续更新。。

    1、css3实现图片划过一束光闪过效果

    1. <a href="#" class="img"><img src="" width="800"></a>
      View Code
      .img { 
          display:block;
          position: relative;
          width:800px;
          height:450px;
          margin:0 auto;
      }
      .img:before {
         content: ""; 
         position: absolute; 
         width:200px; 
         height: 100%;
         top: 0;
         left: -150px;
         overflow: hidden;
         background: -moz-linear-gradient(left, rgba(255,255,255,0)0,        rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%);
        background: -webkit-gradient(linear, left top, right top, color- stop(0%, rgba(255,255,255,0)), color-stop(50%, rgba(255,255,255,.2)), color-stop(100%, rgba(255,255,255,0)));
         background: -webkit-linear-gradient(left, rgba(255,255,255,0)0, rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%);
         background: -o-linear-gradient(left, rgba(255,255,255,0)0, rgba(255,255,255,.2)50%, rgba(255,255,255,0)100%);
         -webkit-transform: skewX(-25deg);
         -moz-transform: skewX(-25deg)
      }
      .img:hover:before {
          left: 150%;
          transition: left 1s ease 0s; 
      }
      View Code

    2、垂直对齐

    .verticalcenter{
        position: relative;
        top: 50%;
        -webkit-transform: translateY(-50%);
        -o-transform: translateY(-50%);
        transform: translateY(-50%);
    }
    View Code

    3、背景渐变动画

    button {
        background-image: linear-gradient(#5187c4, #1c2f45);
        background-size: auto 200%;
        background-position: 0 100%;
        transition: background-position 0.5s;
    }    
    button:hover {
        background-position: 0 0;
    }
    View Code

      4、表格列宽自适用----对于表格,当谈到调整列宽时,是比较痛苦的。然后,这里有一个可以使用的技巧:给td元素添加 white-space: nowrap;能让文本正确的换行

    td {
        white-space: nowrap;
    }
    View Code

      5、包裹长文本---如果你碰到一个比自身容器长的文本,这个技巧对你很有用。在这个示例中,默认时,不管容器的宽度,文本都将水平填充。

    pre {
        white-space: pre-line;
        word-wrap: break-word;
    }
    View Code
  • 相关阅读:
    数据库(SQL Server)管理数据库表~新奇之处
    疯狂C#~伴随着我的库存管理¥
    书中的银行,我们一起奋斗的C#,只因乐在其中~
    MyBatis的经典案例
    Spring MVC的配置文件(XML)的几个经典案列
    Spring MVC注解的一些案列
    WebService的一些案例
    AOP面向切面编程的四种实现
    Struts 2的OGNL的根对象
    Struts 2的拦截器(Interceptor)总结
  • 原文地址:https://www.cnblogs.com/paul-du/p/6282284.html
Copyright © 2011-2022 走看看