栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

CSS内嵌边框

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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 id="something"></div>

这样的好处是它将覆盖的背景图像

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;}<div id="something"></div>

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

#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);}<div id="something">  <div></div></div>

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);}<div id="something"></div>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/615305.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号