图像叠加背景不透明度

时间:2016-02-22 21:04:42

标签: html css image overlay

我试图制作一个图像叠加。当我设置dic" overlay"在图像之上形成一个不透明的图像。

我尝试制作这些代码,但它没有发生任何事情

npm

提前致谢!

2 个答案:

答案 0 :(得分:1)

您需要实际定义叠加层。您需要将 Type DescriptionTotals Dim storeSupply As Double Dim producePurch As Double Dim anotherThing As Double '... you get the picture here End Type sub getTotals() dim matchString As String 'do something here to select a cell, and assign to "matchString" cells(i,j).value = matchString Select Case matchString Case Is "CASH RECIEPT" DescriptionTotals.cashReceipt = DescriptionTotals.cashReceipt + 'value in adjacent cell Case is "NEXT COMPARISON STRING" 'add to the total in your type here. Case Else 'handle string match errors here End Sub background-color应用于background-image

答案 1 :(得分:0)

不确定您的HTML是如何构建的,但这应该对您有所帮助。 根据您现有的代码..

<强> HTML:

<div class="gallery">
    <img src="./img/random.png" />
    <div class="overlay"></div>
</div>

<强> CSS:

.gallery img {
  width:100%;
  height:auto;
  display: block;
  position: relative;
}

.overlay {
  width:100%;
  height: 100%;
  position: absolute;
  top: 0;
  background: rgba(0,0,0,0.4);
}

注意:不透明度需要小于1才能使其有些透明。请注意CSS中的0.4 alpha / opacity设置。

还有其他方法可以解决这个问题,但如果没有您的代码,根据您的具体需求来定制它有点困难。