CSS Module 的 :global 和 :global()有什么区别

新手上路,请多包涵

官方是这样解释的:

:global switches to global scope for the current selector resp. identifier. :global(.xxx) resp. @keyframes :global(xxx) declares the stuff in brackets in the global scope.

感觉用法差不多,实验了几次结果都是一样的,请问这两个有什么区别,实在什么情况下使用的?

阅读 11.9k
1 个回答

:global(xxx) 可以写成 .abc :global(xxx) {...}

:global可以写成
:global {

.a{...}
.b{...}

}

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题