How do I override CSS set on a pseudo element?

前端 未结 2 1028
孤独总比滥情好
孤独总比滥情好 2021-01-31 14:11

I know that has been asked before, but I find no clean way of overriding this CSS:

.ui-input-search:after {
    content:          


        
相关标签:
2条回答
  • 2021-01-31 14:32

    Here content: ""; doesn't affect at all if you want to remove that pseudo you have to use content:none; it will remove previously added pseudo content.

    content:none;
    

    If that doesn't help you can also try :

    display:none; 
    

    if still, it doesn't work then you could try the below, but I never suggest you use !important

     display:none !important;
    

    here is working jsfiddle

    https://jsfiddle.net/ganeshswami99/52duu0x8/1/

    0 讨论(0)
  • 2021-01-31 14:43

    As far as I can tell there is no other way than to override all properties. The styles are defined on the element, they won't just disappear because of another selector that targets the element.

    If you only want to remove the pseudo element from the page you can do content: none.

    Added from comments below:

    The difference between content: "" and content: none is that content: "" produces a pseudo-element with no content (i.e. an empty pseudo-element), whereas content: none prevents the pseudo-element from being generated at all.

    0 讨论(0)
提交回复
热议问题