In the 创建反应应用程序 https://github.com/facebook/create-react-app文档显示 App.css 已导入到 App.js 中。还有一种方法可以从组件加载编译后的 css 文件吗?
// 我的视图组件
import styles from '../../App.css';
您只需在组件中导入如下所示的 css 文件即可
导入'./header.css';
Imagine your header.css file looks like
.header {
background-color: rgb(49, 118, 197);
height:100px;
border:10px solid red;
}
To use the style, you can use the class like ,
<div className="header">Hello World</div>
希望这可以帮助 :)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)