css inset默认值,测试CSS3 clip-path属性的不同inset值的效果

CSS

语言:

CSSSCSS

确定

.test {

float: left;

overflow: hidden;

position: relative;

margin: .25em;

height: 14em;

width: 27em;

box-shadow: 0 0 .125em #777;

font: 1em/14 monospace;

text-align: center;

white-space: pre-wrap;

}

.test:before,

.test:after {

position: absolute;

top: 0;

right: 0;

bottom: 0;

left: 0;

}

.test:before {

box-sizing: border-box;

border: solid 1em #c73a11;

padding: 1em;

background: #ddd;

background-clip: content-box;

content: '';

}

.test--clip-path-inset:nth-child(1):after {

content: 'no clipping applied';

}

.test--clip-path-inset:nth-child(2) {

/* all (top, right, bottom, left) */

}

.test--clip-path-inset:nth-child(2):before {

-webkit-clip-path: inset(8px);

}

.test--clip-path-inset:nth-child(2):after {

content: "inset(8px)";

}

.test--clip-path-inset:nth-child(3):before {

-webkit-clip-path: inset(-1em 15%);

}

.test--clip-path-inset:nth-child(3):after {

content: "inset(-1em 15%)";

}

.test--clip-path-inset:nth-child(4):before {

-webkit-clip-path: inset(-1em 2vw calc(50% - 1vmin));

}

.test--clip-path-inset:nth-child(4):after {

content: "inset(-1em 2vw calc(50% - 1vmin))";

}

.test--clip-path-inset:nth-child(5):before {

-webkit-clip-path: inset(4vh 15% 3vh -1vmax);

}

.test--clip-path-inset:nth-child(5):after {

content: "inset(4vh 15% 3vh -1vmax)";

}

.test--clip-path-inset:nth-child(6) {

/* 50% top + 50% bottom = 100% height */

}

.test--clip-path-inset:nth-child(6):before {

-webkit-clip-path: inset(50% 1px);

}

.test--clip-path-inset:nth-child(6):after {

content: "inset(50% 1px)";

}

.test--clip-path-inset:nth-child(7) {

/* calc(50% + 30vmin) right + calc(50% + 30vmin) left > 100% width */

}

.test--clip-path-inset:nth-child(7):before {

-webkit-clip-path: inset(-1em calc(50% + 30vmin));

}

.test--clip-path-inset:nth-child(7):after {

content: "inset(-1em calc(50% + 30vmin))";

}

.test--clip-path-inset:nth-child(8) {

/* basic usage */

}

.test--clip-path-inset:nth-child(8):before {

-webkit-clip-path: inset(3em round 1em);

}

.test--clip-path-inset:nth-child(8):after {

content: "inset(3em round 1em)";

}

.test--clip-path-inset:nth-child(9) {

/* with negative insets */

}

.test--clip-path-inset:nth-child(9):before {

-webkit-clip-path: inset(-1em round 50%);

}

.test--clip-path-inset:nth-child(9):after {

content: "inset(-1em round 50%)";

}

.test--clip-path-inset:nth-child(10):before {

-webkit-clip-path: inset(2vw round calc(50% - 8px) 3em);

}

.test--clip-path-inset:nth-child(10):after {

content: "inset(2vw round calc(50% - 8px) 3em)";

}

.test--clip-path-inset:nth-child(11):before {

-webkit-clip-path: inset(0 round 50% 1.5em 0);

}

.test--clip-path-inset:nth-child(11):after {

content: "inset(0 round 50% 1.5em 0)";

}

.test--clip-path-inset:nth-child(12):before {

-webkit-clip-path: inset(0 round 50% 5em 0 8px);

}

.test--clip-path-inset:nth-child(12):after {

content: "inset(0 round 50% 5em 0 8px)";

}

.test--clip-path-inset:nth-child(13):before {

-webkit-clip-path: inset(0 2.5em round 5em/50%);

}

.test--clip-path-inset:nth-child(13):after {

content: "inset(0 2.5em round 5em/50%)";

}

.test--clip-path-inset:nth-child(14) {

/*mix them*/

}

.test--clip-path-inset:nth-child(14):before {

-webkit-clip-path: inset(20px 2em round 8em/65% 0 4vw);

}

.test--clip-path-inset:nth-child(14):after {

content: "inset(20px 2em round 8em/65% 0 4vw)";

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值