【发布时间】:2021-02-21 00:49:46
【问题描述】:
我使用 Twemoji 库在我的 Next js 应用程序中获取表情符号图标,它们在最终 HTML 中显示为 <span><img></span>,我可以在我的 globals.scss 文件中使用 !important 覆盖它们的默认宽度和高度:
.customize { //Parent class containers 3 buttons, each one has an emoji element
top: 88%;
right: calc(50vw - (52.2px + 3rem));
button {
span img[style]{
width: 35px !important;
height: 35px !important;
}
}
}
然后我尝试将其提取为[].module.scss 文件,一切正常,但图像大小没有任何变化。为什么?
编辑 这是我要设置样式的组件:
import ThemeButton from '../components/themeCustomizeButton' // a button that renders an emoji
import LanguageSwitcher from '../components/LanguageSwitch' // a button that renders an emoji
import Complex from '../components/ComplexitySwitch' // a button that renders an emoji
import styles from "../styles/local/components/customize.module.scss" // importing .module.scss
function Customizing() {
return(
<section className={styles.customize}>
<ThemeButton />
<LanguageSwitcher />
<Complex />
</section>
)
}
export default Customizing
【问题讨论】:
-
你是如何应用 Sass 模块中的样式的?你能分享你在那个组件中的代码吗?
-
@juliomalves 我将组件添加到问题中
标签: html css next.js css-modules