html 边框如何嵌套,CSS内嵌边框

小编典典

您可以使用box-shadow,可能是:

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

box-shadow: inset 0 0 10px #0f0;

}

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

box-shadow: inset 0 0 10px #0f0;

}

这样的好处是它将覆盖的背景图像div,但是当然会模糊(正如您希望从box-

shadow属性中看到的那样)。要建立density阴影的阴影,您当然可以添加其他阴影:

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

box-shadow: inset 0 0 20px #0f0, inset 0 0 20px #0f0, inset 0 0 20px #0f0;

}

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

box-shadow: inset 0 0 20px #0f0, inset 0 0 20px #0f0, inset 0 0 20px #0f0;

}

编辑 因为我意识到,我是个白痴,忘了提供简单的解决方案 首先 ,它是使用,否则空的子元素应用在背景的边界:

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

padding: 0;

position: relative;

}

#something div {

position: absolute;

top: 0;

left: 0;

right: 0;

bottom: 0;

border: 10px solid rgba(0, 255, 0, 0.6);

}

jsfiddle.net/dPcDu/2中,您可以为其添加第4个px参数,以box-shadow进行传播并更轻松地反映其图像。

#something {

background: transparent url(https://i.stack.imgur.com/RL5UH.png) 50% 50% no-repeat;

min-width: 300px;

min-height: 300px;

box-shadow: inset 0 0 0 10px rgba(0, 255, 0, 0.5);

}

2020-05-16

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值