【发布时间】:2019-07-30 19:22:27
【问题描述】:
我有一张背景图片覆盖了我正在处理的主页的整个页面,并希望用户能够通过内容看到背景图片。我在页面上有卡片作为列,并将它们设置为 0.8 不透明度。我遇到的问题是这种不透明度也适用于卡体内包含的任何图像。 IE你可以通过它们看到背景图片。
我尝试让<img> 标签的不透明度为 1,使实际图像的不透明度为 1,并将图像放入自己的 <div>,不透明度为 1。我也尝试使用样式属性,但也没有任何乐趣.在 Google 或 Stack Overflow 上找不到任何内容。
// CSS
// Translucent foreground
.card.t-lucent {
opacity: 0.8;
}
// Home full body background
.home-bg {
background: url(img/bg/world-war-ii-60541_1920.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
// Newspaper
.newspaper {
font-family: 'Belgrano', serif;
}
// HTML
<body class="{{ request()->path() }}-bg">
<div class="card t-lucent newspaper">
<div class="card-body">
<h1 class="card-title text-center display-4">
Welcome!
</h1>
<img class="img rounded float-left mr-3 opq-img" src="{{ asset('img/ww1_soldier_statue.jpg') }}" alt="WW1 soldier statue" />
<p class="card-text">some text some text some text some text some text some text some text some text some text</p>
<p class="card-text">some text some text some text some text some text some text some text some text </p>
</div>
</div>
</body>
【问题讨论】:
标签: twitter-bootstrap opacity laravel-5.8