zoukankan      html  css  js  c++  java
  • css切角效果,折角效果

    html

    <div class="one">12345</div>
    <div class="two">abcde</div>

    css

      .one{
        height: 200px;
        width: 200px;
        margin: 10px auto;
        line-height: 200px;
        background: yellowgreen;
        background: 
                  linear-gradient(-45deg,transparent 15px, yellowgreen 0)bottom right,
                  linear-gradient(-135deg,transparent 15px, yellowgreen 0)top right,
                  linear-gradient(135deg,transparent 15px, yellowgreen 0)top left,
                  linear-gradient(45deg,transparent 15px, yellowgreen 0)bottom left;
                  background-size: 50% 50%;
                  background-repeat: no-repeat;
      }
      .two{
        height: 200px;
        width: 200px;
        margin: 10px auto;
        background: #58a;
        line-height: 200px;
        background: 
                  radial-gradient(circle at bottom right,transparent 15px, #58a 0)bottom right,
                  radial-gradient(circle at top right,transparent 15px, #58a 0)top right,
                  radial-gradient(circle at top left,transparent 15px, #58a 0)top left,
                  radial-gradient(circle at bottom left,transparent 15px, #58a 0)bottom left;
                  background-size: 50% 50%;
                  background-repeat: no-repeat;
      }

    acss的也可以这样写

    @mixin current_color($bg,$tr){
      background: $bg;
      background: 
                  linear-gradient(-45deg,transparent $tr, $bg 0)bottom right,
                  linear-gradient(-135deg,transparent $tr, $bg 0)top right,
                  linear-gradient(135deg,transparent $tr, $bg 0)top left,
                  linear-gradient(45deg,transparent $tr, $bg 0)bottom left;
                  background-size: 50% 50%;
                  background-repeat: no-repeat;
    }
    .one{
        height: 200px;
        width: 200px;
        margin: 10px auto;
        line-height: 200px;
        @include current_color(yellowgreen,15px)
      }

    如图效果

  • 相关阅读:
    响应式网页设计初探
    karma 启动提示PhantomJS not found on PATH
    Vuex 拾遗
    cStringIO 实现指定大小的字符串缓存
    javascript 计算文件MD5 浏览器 javascript读取文件内容
    springmvc值传递
    SpringMVC
    spring事务
    spring整合JDBC
    spring-test与junit
  • 原文地址:https://www.cnblogs.com/yhhBKY/p/10642696.html
Copyright © 2011-2022 走看看