css - 通过应用 SCSS 类来设置 toast 容器的样式
问题描述
我正在尝试设计react-toastify
吐司容器的样式:
<ToastContainer style={{width: "30%"}} className="toast"
position="top-center"
etc.
/>
这是SCSS:
.toast {
width: 30%; // affects the text, not the container
font-size: 2rem;
text-align: center;
& img {
width: 3rem; // no effect
}
}
width: 30%
在 style 属性中按预期工作,即设置容器的宽度。为什么类中的相同属性会影响文本,即使文本变窄?
的样式img
是试图使图标变大。我怀疑这个尝试失败了,因为图标是一个字符,而不是一个图像。但是,我找不到如何设置它的字体大小。有任何想法吗?
编辑:这是我在元素资源管理器中看到的:
解决方案
推荐阅读
- c - 如何从 byte64 编码的字符串中删除额外的填充?
- java - 使用http post方法获取jwt token,然后在swagger页面的每个api方法中传递
- html - 无法导航到角度 10 中的其他组件页面
- python - Pandas - 如何根据其他列减去行值?
- python - 如何在python中计算随机森林的训练和测试数据之间的准确性
- java - 更改 ListView 一行的文本颜色
- go - 无法将 nil(无类型的 nil 值)转换为 struct
- selenium - 错误:“列表”对象没有“点击”属性 - Selenium Webdriver
- javascript - 如何改进这个 JS 代码看起来更优雅
- html - align-items:stretch 和 align-self:stretch 在没有固定高度的 flex 行中不起作用