Html 视差图像的不透明度

Html 视差图像的不透明度,html,css,inheritance,parallax,Html,Css,Inheritance,Parallax,我有一个父div,用于视差img滚动功能。我希望视差图像的不透明度大约为不透明度:45%;其中所有含量均为不透明度:100%; 我一直在寻找,但没有找到一个方法来做到这一点?它们是直接在背景图像上设置不透明度的一种方法吗 html 这里有一个建议的解决方案,目前我不知道有哪种解决方案可以实现为只将容器不透明度设置为45%,我通常实现的唯一方法是使用单独的 前端Web开发人员 约翰 <div class="img1"> <div class="containe

我有一个父div,用于视差img滚动功能。我希望视差图像的不透明度大约为不透明度:45%;其中所有含量均为不透明度:100%; 我一直在寻找,但没有找到一个方法来做到这一点?它们是直接在背景图像上设置不透明度的一种方法吗

html


这里有一个建议的解决方案,目前我不知道有哪种解决方案可以实现为只将容器不透明度设置为
45%
,我通常实现的唯一方法是使用单独的



前端Web开发人员 约翰
<div class="img1">
        <div class="container img1-container">
            <!-- <div class="card"> -->
            <img id="head-shot" src="./assets/images/john-headshots-5.jpg" alt="head-shot">
            <br><br>
            <h1 class="intro-text web-dev"> Front-End Web Developer</h1>

            <h4 class="intro-text john-sass">John</h4>


            <!-- </div> -->
        </div>
    </div>
.img1 {
    background-image: url(/assets/images/skyline-1402050_1920.jpg);
    min-height: 100%;
    min-width: 100%;
    opacity: 45%;
}
/* headshot img */
#head-shot {
    text-align: center;
    border-radius: 100%;
    height: 300px;
    width: 350px;
}