I am trying to make my background image transparent, and the rest of the page not transparent, eg a faded background image on top of non faded HTML and CSS.
I have an HTML page with an image as the background using a div. Below is a simplified version of the page:
<HTML>
<head>
<style type="text/css">
#backgroundImage {
background-image: url('../Documents/images/Sea.jpg');
background-repeat: no-repeat;
background-size: 100%;
opacity: 0.4;
filter:alpha(opacity=40);
height:100%;
width:100%;
z-index:0.1;
}
.main{
height:500px;
width:900px;
margin:auto;
background-color:green;
z-index:1;
opacity: 1;
filter:alpha(opacity=100);
}
</style>
</head>
<body>
<div id="backgroundImage">
<div class="main">
</div>
</div>
</body>
I found this setup in the following question:
and it almost works, except that the whole page is transparent, not just the background image.
I have tried adjusting the Z-index and opacity on the 'main' div, but it is not working.
I feel this is a simple fix but I just cant see the solution.
I also tried this question, but it did not seem to offer a solution:
How do i make my background image transparent in CSS if I have the following code?
and this one:
I do not have sufficient reputation to post an image of what I am trying to achieve.