提问者:小点点

受图像不透明度影响的div元素不透明度


null

.html,.body{
    background-size: cover;
}

body{
    overflow-x: hidden;
    margin:0;
    background: rgba(0, 0, 0, 0.1);

}
.welcome-container{
    position: relative;
    top:0px;
    left: 0px;
    width:100%;
    height:550px;
    margin:0px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    



}

.welcome-pic{
    position: relative;
}


.welcome-pic img{
    background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('file:///Volumes/Animus/Jon/Dropbox/website/hellcity.jpg');
}

.ds-square{
    background-color:red;
    height: 50px;
    width:50px;
    position: absolute;
    top: 2px;
    left: 2%;
    opacity:1;

}

.welcome-pic img {
    width:100%;
    height:550px;
    opacity: 0.8;
}

.inside-pic{
    position:absolute;
    top:30%;
    left:50%;
    font-size: 60px;
    transform: translate(-50%, -50%);
}

.inside-pic h3{
    font-size:18px;
}
<div class = "welcome-container">
      <div class = "welcome-pic">
      //my square 
        <div class="ds-square">
        </div>
        <img src = "IMAGES/welcome_pic.jpg" alt="#">
        <div class = "inside-pic">
         
          FLY WITH  DS <br/> AIRLINES
          <h3>Flights from or towards Athens ! Fly secure and comfortable with us! </h3> 
        </div>
      </div>
    </div>

null

在方块上尝试不透明度:1;不会改变结果。 如果你能帮我完成这个简单的任务,我将不胜感激。 事先谢谢你


共1个答案

匿名用户

null

.html,.body{
    background-size: cover;
}

body{
    overflow-x: hidden;
    margin:0;
    background: rgba(0, 0, 0, 0.1);

}
.welcome-container{
    position: relative;
    top:0px;
    left: 0px;
    width:100%;
    height:550px;
    margin:0px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    



}

.welcome-pic{
    position: relative;
}


.welcome-pic img{
    background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('file:///Volumes/Animus/Jon/Dropbox/website/hellcity.jpg');
}

.ds-square{
    background-color:rgba(255,0,0,0.4);
    height: 50px;
    width:50px;
    position: absolute;
    top: 2px;
    left: 2%;
    opacity:1;

}

.welcome-pic img {
    width:100%;
    height:550px;
    opacity: 0.8;
}

.inside-pic{
    position:absolute;
    top:30%;
    left:50%;
    font-size: 60px;
    transform: translate(-50%, -50%);
}

.inside-pic h3{
    font-size:18px;
}
<div class = "welcome-container">
      <div class = "welcome-pic">
      //my square 
        <div class="ds-square">
        </div>
        <img src = "IMAGES/welcome_pic.jpg" alt="#">
        <div class = "inside-pic">
         
          FLY WITH  DS <br/> AIRLINES
          <h3>Flights from or towards Athens ! Fly secure and comfortable with us! </h3> 
        </div>
      </div>
    </div>