CSS Color Filter Overlay

前端 未结 4 1878
太阳男子
太阳男子 2021-02-15 19:33

I\'m trying to create a color overlay over an image, like in this app (the green overlay over the image):

http://i.imgur.com/4XK9J6G.png

To me, it doesn\'t look

4条回答
  •  甜味超标
    2021-02-15 20:10

    HTML:

     
    Put your contetnt here

    CSS:

    .image-container {
        position: relative;
        width: 200px;
        height: 300px;
    }
    .image-container .after {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: none;
        color: #FFF;
    }
    .image-container:hover .after {
        display: block;
        transition:all 0.2s ease;
        background: rgba(0, 0, 0, .6);
    }   
    

    Result:Overlay

    Other solution is that useing CSS filter.such as Filter Functions .
    Exmple:

    ukulele   
    

    CSS:

     img { display: block; width: 90%; }
    
        img {
          -webkit-filter: sepia(1);
          filter: sepia(1);
        }  
    

    and result:Filter Functions
    read more info here

提交回复
热议问题