cursor:pointer on pseudo element IE

后端 未结 5 829
有刺的猬
有刺的猬 2020-12-18 20:13

I am implementing a close button on an element containing text with CSS. The close button is generated content from a pseudo element with content:\'X\';. I need

5条回答
  •  抹茶落季
    2020-12-18 20:45

    I believe that it's not working in pseudo elements in IE, What I'm use to do is add cursor: ponter to main element.

    If you need to add cursor: pointer to pseudo element only, than only way is to add child element

    like:

    some text
    div{ font-size:2em; position:relative; display:inline-block; } div > span{ cursor:pointer; } div > span::before{ content:'X'; display:block; text-align:right; }

    But than is no point to using pseudo class...

    demo

提交回复
热议问题