How can I invert color using CSS?

前端 未结 3 1797
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 01:37

HTML

inverted color

CSS

div {
    background-color: #f00;
}
p { 
    color:         


        
3条回答
  •  有刺的猬
    2020-12-05 02:24

    Add the same color of the background to the paragraph and then invert with CSS:

    div {
        background-color: #f00;
    }
    
    p { 
        color: #f00;
        -webkit-filter: invert(100%);
        filter: invert(100%);
    }

    inverted color

提交回复
热议问题