我剛剛學習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