请问一下,为什么我这里使用了bootsrap的样式,但是没有效果呢?
来源:5-1 为项目选择样式库

慕慕0439991
2020-07-14
张老师,您好,在我这里用了bootstrap的样式,但是好像没有效果,
import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
export default function HomePage() {
return (
<div className="App container-fluid">
<div className="row">
<div className="col-3 bg-light left-panel">
<h1>this is the left this is the left this is the left</h1>
</div>
<div className="col-9 bg-primary right-panel">
<h1>this is the right</h1>
</div>
</div>
</div>
);
}
请问一下,这个该怎么解决呢?
写回答
2回答
-
同学你好 看了你的提问和代码 原来你使用的 electron-react-boilerplate,我的项目中都使用的 create-react-app ,它的webpack 配置直接支持 css 文件的 import。但是你采用的脚手架好像不支持直接 css 文件的 import,这里有一个解决方案,正是你需要的,也是在它们的 issue 中找到的。
https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/468
// 在 app.global.css 中,使用波浪线 @import '~semantic-ui-css/semantic.min.css';
同学你在 github 提问的非常棒,英文水平不错,我很喜欢这种尝试主动寻找答案的行为,给你点赞!
112020-07-17 -
张轩
2020-07-14
同学你好 请问 bootstrap 是否安装成功了呢?可以查看一下 node_modules 下是否有对应这个路径的文件 “bootstrap/dist/css/bootstrap.min.css”
052020-07-15
相似问题