How to overlay image with color in CSS?

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

    You may use negative superthick semi-transparent border...

    .red {
        outline: 100px solid rgba(255, 0, 0, 0.5) !important;
        outline-offset: -100px;
        overflow: hidden;
        position: relative;
        height: 200px;
        width: 200px;
    }
    Anything can be red.

    Or even image...

    This solution requires you to know exact sizes of covered object.

提交回复
热议问题