我刚刚学习Bootstrap并试图找出一种显示带有不透明背景图像的内容的好方法。我目前正在使用“好”,但不必。我可以将图像从“井”里面取出来,并且不透明,但我无法将它“隐藏”在其他内容之后。下面是HTML的一个小样本:带有不透明背景图像的引导内容
.background1{
background-size:cover;
opacity: .25;
max-width: 1130px;
}
<div class="well">
<div class="row">
<img class="img-rounded background1" src="/Images/housing-4-1213183.jpg" alt="housing" />
<h2>Section Title Here</h2>
<p>This is just a place holder for text content that would be showed on top of the desired image.</p>
</div>
</div>
如果有较好的一类,以用于内容请让我知道。
你试图让顶部或半透明的文字下方图片?你的问题不清楚。提醒:不透明的意思是“看不透”,半透明的手段是半透明的,透明的,显然是完全透明的。 – mix3d
然而,由于您试图使用css opacity来调整图像的半透明度,因此解决方案是使用绝对定位和z-indexing,因此将其从渲染流中提取出来,从而允许您的“内容”渲染顶部(或以下,取决于z索引如何完成) – mix3d
mix3d我希望图像“褪色”,并在背景中和文本“顶部”不褪色。这更清楚吗? – dblwizard