css实现切角效果(弧形切角)

在这之前先熟悉一个css属性
linear-gradient()函数用于创建一个线性渐变的“图像”。
语法

background :linear - gradient (direction ,color - stop1 ,color - stop2 ,...); 

direction: 用角度值指定渐变的方向(或角度)。
color-stop1, color-stop2,...: 用于指定渐变的起止颜色。

效果截图

实现代码

  width: 200px;
  height: 150px;
  background: linear-gradient(-45deg,transparent 20px, aqua 0);
效果截图

实现代码(设置两个不同颜色,便于理解)

    background: linear-gradient(-45deg, transparent 20px, #3e5858 0) right, 
          linear-gradient(45deg, transparent 20px, #2fa2a2 0) left;
    background-size: 50% 100%;
    background-repeat: no-repeat;
效果截图

实现代码

  width: 200px;
  height: 150px;
  background: linear-gradient(-45deg,transparent 15px,aqua 0) bottom right,
              linear-gradient(45deg,transparent 15px,aqua 0) bottom left,
              linear-gradient(135deg,transparent 15px,aqua 0) top left,
              linear-gradient(-135deg,transparent 15px,aqua 0) top right;
  background-size: 50% 50%;
  background-repeat: no-repeat;

效果截图

实现代码

  width: 200px;
  height: 150px;
  background: radial-gradient(circle at bottom right, transparent 15px, aqua 0)
      bottom right,
    radial-gradient(circle at bottom left, transparent 15px, aqua 0) bottom left,
    radial-gradient(circle at top left, transparent 15px, aqua 0) top left,
    radial-gradient(circle at top right, transparent 15px, aqua 0) top right;
  background-size: 50% 50%;
  background-repeat: no-repeat;
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • -webkit-linear-gradient线形渐变详解 CSS3发布很久了,现在在国外的一些页面上常能看到他的...
    魏魏魏_1500阅读 15,675评论 0 3
  • 一、CSS入门 1、css选择器 选择器的作用是“用于确定(选定)要进行样式设定的标签(元素)”。 有若干种形式的...
    宠辱不惊丶岁月静好阅读 1,668评论 0 6
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,682评论 0 7
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,357评论 0 11
  • 完成了扇贝分析 单词打卡 下单了两本书 确认邮件发送 开始整理笔记
    Echo_6641阅读 159评论 0 0