X close button only using css

后端 未结 8 1581
感情败类
感情败类 2020-12-25 10:21

How to make a cross (X) only in css3, to use as a close button ?

I\'ve been searching since long time, i cannot found how.... When i look at source code on website u

8条回答
  •  清歌不尽
    2020-12-25 10:57

    As a pure CSS solution for the close or 'times' symbol you can use the ISO code with the content property. I often use this for :after or :before pseudo selectors.

    The content code is \00d7.

    Example

    div:after{
      display: inline-block;
      content: "\00d7"; /* This will render the 'X' */
    }
    

    You can then style and position the pseudo selector in any way you want. Hope this helps someone :).

提交回复
热议问题