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)
      }

    如图效果

  • 相关阅读:
    android 单位详解
    ViewFlipper的使用
    today is history,today is tomorrow
    Android2.1 和之后的版本 中的 drawable(hdpi,ldpi,mdpi) 的区别
    auto_ptr
    android编写Service入门
    Android程序完全退出的三种方法
    Android中Toast的用法简介
    安装android开发环境
    error C2850: 'PCH header file'
  • 原文地址:https://www.cnblogs.com/yhhBKY/p/10642696.html
Copyright © 2011-2022 走看看