nfssuzukaze / Blog

0 stars 0 forks source link

box-shadow 及其应用 #10

Open nfssuzukaze opened 3 years ago

nfssuzukaze commented 3 years ago

1. box-shadow

box-shadow: [inset]? [offset-x] [offset-y] [blur-radius]? [spread-radius]? [color]?

2. box-shadow 的应用

2.1 box-shadow 模拟 outline,并实现圆角效果

box-shadow 实现圆角的前提是 border 是圆角的

<div class="box"></div>
.box {
    background-color: grey;
    height: 40px;
    width: 600px;
    border-radius: 20px;
    box-shadow: 0 0 0 10px yellow; /*模拟 1px 的黄色圆角 outline*/
}

效果:2020-11-18_18-34