How to overlay image with color in CSS?

前端 未结 11 801
轻奢々
轻奢々 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:35

    #header.overlay {
        background-color: SlateGray;
        position:relative;
        width: 100%;
        height: 100%;
        opacity: 0.20;
        -moz-opacity: 20%;
        -webkit-opacity: 20%;
        z-index: 2;
    }
    

    Something like this. Just add the overlay class to the header, obviously.

提交回复
热议问题