Before and After pseudo classes used with styled-components

前端 未结 4 1747
抹茶落季
抹茶落季 2020-12-28 12:23

What is the proper way to apply :before and :after pseudo classes to styled components?

I know that you can use

&:hover

4条回答
  •  天涯浪人
    2020-12-28 13:21

    Pseudo-selectors in styled-components work just like they do in CSS. (or rather, Sass) Whatever isn't working is likely a problem in your specific code, but that's hard to debug without seeing the actual code!

    Here is an example of how to use a simple :after:

    const UnicornAfter = styled.div`
      &:after {
        content: " 

提交回复
热议问题