How to overlay image with color in CSS?

前端 未结 11 803
轻奢々
轻奢々 2020-12-14 13:51

Objective

I want a color overlay on this header element. How can I do this with CSS?

Code

HTML

11条回答
  •  不思量自难忘°
    2020-12-14 14:34

    You should use rgba for overlaying your element with photos.rgba is a way to declare a color in CSS that includes alpha transparency support. you can use .row as an overlayer like this:

    #header {
        background: url(../img/bg.jpg) 0 0 no-repeat fixed;
        height: 100%;
        overflow: hidden;
        color: #FFFFFF
     }
    
    .row{
        background: rgba(39,62,84,0.82);
        overflow: hidden;
        height: 100%;
        z-index: 2;
    }
    

提交回复
热议问题