Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.2k views
in Technique[技术] by (71.8m points)

圆角矩形使用box-shadow 如何让影子也变成圆角呢

image.png

圆角矩形{
            width: 360upx;
            height: 88upx;
            line-height: 88upx;
            color: #fff;
            font-size: 36upx;
            background: #2b83ff;
            outline: none;
            border: none;
            border-radius: 50upx;
            background: -webkit-linear-gradient(to right, #7FBBFE, #2E88ED);
            background: -o-linear-gradient(to right, #7FBBFE, #2E88ED);
            background: -moz-linear-gradient(to right, #7FBBFE, #2E88ED);
            background: linear-gradient(to right, #7FBBFE, #2E88ED);
            box-shadow: 0px 7px 24px 0px rgba(46, 136, 237, 0.9);
        }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

box-shadow 的轨迹本来就是与边框一致的。
从截图来看,这个圆角形的外面有一个容器剪切了溢出的阴影,把这个容器的 overflow 设为 visibile 应该就可以,如果不行的话就是更外层的元素剪切了,同样的解决方案。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...