html4个角都有阴影,html – 如何创建这个有角度的阴影(没有图像)?

不是真的要解释得太多,因为你已经知道它是如何工作的.对于那些没有 – 基本上,我在父母上添加了线性渐变背景.然后我在每一侧覆盖CSS三角形(通过:在/之后添加),以实现所需的外观.

它适用于所有主流浏览器.虽然它确实在Chrome中看起来更好,因为FF会在三角形上产生锯齿状边缘.

HTML

CSS

#two {

width: 940px;

height: 350px;

padding: 0;

margin-left: 10px;

position: relative;

background: rgb(255,255,255);

background: -moz-linear-gradient(top, rgba(255,255,255,1) 2%, rgba(0,0,0,1) 40%, rgba(0,0,0,1) 60%, rgba(255,255,255,1) 98%);

background: -webkit-linear-gradient(top, rgba(255,255,255,1) 2%,rgba(0,0,0,1) 40%,rgba(0,0,0,1) 60%,rgba(255,255,255,1) 98%);

background: linear-gradient(to bottom, rgba(255,255,255,1) 2%,rgba(0,0,0,1) 40%,rgba(0,0,0,1) 60%,rgba(255,255,255,1) 98%);

}

#two > div {

background-color: purple;

width: 920px;

height: 100%;

margin: 0px auto;

}

#two:before, #two:after {

content: "";

width: 10px;

height: 0px;

border-top: 175px solid transparent;

border-bottom: 175px solid transparent;

position: absolute;

top: 0;

}

#two:before {

left: 0px;

border-left: 10px solid white;

}

#two:after {

right: 0px;

border-right: 10px solid white;

}

让我知道你的想法 – 据我所知,他们看起来一样.可以稍微调整渐变以使它们相同.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值