ant-design / antd-style

css-in-js library with antd v5 token system
https://ant-design.github.io/antd-style/
MIT License
187 stars 29 forks source link

🧐[问题]新手咨询下样式嵌套问题 #104

Closed ygxw closed 10 months ago

ygxw commented 10 months ago

🧐 问题描述

请教大佬一个问题,之前一直用的less和scss,但现在升级antd后,想用新的cssinjs,不过有一种写法怎么改成antd-style的写法呢?

老的less写法如下:

.样式名称1 { color:#000000; background-color:#ffffff; } .样式名称1下面的一个子标题文字样式 { color:rgba(0,0,0,.5); } .样式名称1选中样式 { color:#ffffff; background-color:blue;

.样式名称1下面的一个子标题文字样式 { color:#ffffff; } }

想要的效果如下: image

其实最主要就是以前“样式名称1选中样式”下面覆盖了一个“样式名称1下面的一个子标题文字样式”,这种写法怎么改?或者用什么思路?

新手请教,原谅我可能提的问题有点小白。

arvinxx commented 10 months ago

看看是否是你想要的:https://ant-design.github.io/antd-style/best-practice/nest-element-style

ygxw commented 10 months ago

点赞,要的就是这个,谢谢大佬。