【发布时间】:2018-10-29 22:03:40
【问题描述】:
我遇到了问题...我想让我的背景图片半透明。但是,我希望 div 中的文本完全可见。有小费吗?提前致谢
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Stack</title>
<style type="text/css">
#recipebackground{
/* The image used */
background-image: url("../imgs/ajiacobackground.jpg");
/* Full height */
height: 50%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/*opacity*/
opacity: 0.5;
}
</style>
</head>
<body>
<section id="recipebackground" class="opacitybox">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<section>
<div class="container" >
<h1 style="font-size: 350%;" class="text-center"><b>It's Lunch-Time!</b></h1>
</div>
</section>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
另外请注意,我在我的文件中使用了 bootstrap。谢谢
【问题讨论】: