【发布时间】:2015-04-01 22:14:51
【问题描述】:
我想在我的 div 周围制作一个透明的边框。我希望背景图像通过透明边框显示。在我的图片中,您可以看到我的代码创建了一个透明边框,但白色显示通过而不是背景图像。无论我制作什么尺寸的边框,它基本上都会增加空白以适应边框。
以下是我的代码,包括 .mainbody 的边框和背景图片。我在想,也许是我的代码干扰了背景图像上的边框透明度。
.mainbody {
max-width: 1500px;
height: auto;
background: white;
margin-top: -27px;
border: 10px dashed rgba(236, 200, 236, .5);
}
body {
background: url("https://scenesfromphiladelphia.files.wordpress.com/2010/02/026.jpg");
background-size: cover;
background-position: center;
text-align: left;
text-indent: 50px;
color: 000000;
font-family: Bree Serif;
max-width: 800px;
margin: auto;
}
【问题讨论】:
-
@MarcB 是的,背景剪辑:填充框就是答案
-
@MarcB 这很有帮助。谢谢。
标签: css border background-image transparency