弥散阴影html,前端说这个弥散阴影我做不了,请让开,我来!

本文介绍了一种使用CSS伪元素:before来实现更自然、渐变色的阴影效果的方法,避免了传统box-shadow()带来的挖空锯齿问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

弥散阴影

*{margin: 0;padding: 0;}

.box{

border: 0px;

outline: none;

display: inline-block;

padding: 30px 100px;

margin: 100px 200px;

background: linear-gradient(to left,#fa6c9f 0%,#ffe140 80%,#ffe140 80%);

border-radius: 1000px;

color: #ffffff;

letter-spacing: 1px;

text-transform: uppercase;

font-size:60px ;

position: relative;

transition: all 0.3s ease-out;

user-select: none;

-webkit-user-select: none;

}

.box:before{

content: "";

background: inherit;

width: calc(100% - 60px);

height: 60px;

border-radius: 1000px;

display: inline-block;

position: absolute;

left: 30px;

bottom: 0;

z-index: -1;

filter: blur(30px) brightness(0.95);

}

Superme

————————————————————————分割线————————

传统会用box-shadow()这个样式来做阴影,这样做看上去并不是那么自然,做不到渐变色,遇见有挖空的地方就会是这样,挖空的锯齿让颜色填充了,尴尬。用:before就可以避免了。

52ff19a401ace6c05d72591fe03a4fc0.png

下面按钮是用以上代码做的。注意几点。

用button按钮,文字用pading撑开比较好。

必须使用定位(position),

使用user-seoect:none可以避免点击复制文字。

befoue要和content:“”;一期用。阴影的高等文字的大小,blur大小是文字大小一半。

439a1bbd22ebc4e66edea9069f6ebb17.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值