clip-path
clip-path
属性使用裁剪方式创建元素的可显示区域。区域内的部分显示,区域外的隐藏。
circle
定义一个圆,语法:circle( [ <shape-radius> ]? [ at <position> ]? )
可选参数表示:
- 半径,默认元素宽高中短的那个为直径,支持百分比
- 圆心坐标,默认为元素中心点
例如半径占 30%,圆心坐标在(40px, 50px),零点在左上角
clip-path: circle(30% at 40px 50px);
inset
定义一个矩形,语法:inset( <length-percentage>{1,4} [ round <border-radius> ]? )
inset()可以传入 5 个参数,分别对应 top,right,bottom,left 的裁剪位置,round radius(可选,圆角)
示例
clip-path: inset(100px 50px);
clip-path: inset(2em 3em 2em 1em round 2em);