我使用Bootstrap v4創建包含帶有標題文本的圖像的旋轉木馬。我希望圖像變淡,但文字不受影響。我嘗試過各種非Bootstrap解決方案,但我無法獲得任何工作。請幫助:(如何使用Bootstrap的旋轉木馬組件改變圖像的不透明度但不覆蓋文本
鏈接到開發網站; http://www.atlasestateagents.co.uk/mlb/
代碼:
<div id="home-page-carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#home-page-carousel" data-slide-to="0" class="active"></li>
<li data-target="#home-page-carousel" data-slide-to="1"></li>
</ol>
<!-- Content -->
<div class="carousel-inner" role="listbox">
<!-- Slide 1 -->
<div class="carousel-item active"> <img src="<?php echo SITE_IMG . 'L1.jpg'; ?>" alt="Liverpool City Centre">
<div class="carousel-caption">
<h3>This is a title</h3>
<p>This is some text that is relevant to the title above</p>
</div>
</div>
<!-- Slide 2 -->
<div class="carousel-item"> <img src="<?php echo SITE_IMG . 'L1.jpg'; ?>" alt="Liverpool City Centre">
<div class="carousel-caption">
<h3>This is a title</h3>
<p>This is some text that is relevant to the title above</p>
</div>
</div>
</div>
<!-- Previous/Next controls -->
<a class="left carousel-control" href="#home-page-carousel" role="button" data-slide="prev"> <span class="icon-prev" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#home-page-carousel" role="button" data-slide="next"> <span class="icon-next" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div>
<!-- Center the image -->
<style scoped>
.carousel-item img{
margin: 0 auto;
}
</style>
檢查了這一點[上滑塊靜態文本(http://bootsnipp.com/snippets/featured/carousel-static-headline -caption) – Suraj
@Suraj - 這對我有幫助嗎?我看不到有關不透明的任何內容? –
爲什麼不在圖像上設置「不透明度」值?標題不是他們的孩子,所以不會繼承不透明 – Andy