Bootstrap样式不适用于我的angular 2项目 [英] Bootstrap styles not applying to my angular 2 project

查看:77
本文介绍了Bootstrap样式不适用于我的angular 2项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在angular-cli.json-样式中添加了引导CSS.不对我的项目应用引导样式.我在package.json中添加了npm并进行了安装.该如何解决?

I added bootstrap css in angular-cli.json - styles. Not applying bootstrap styles to my project. I added in package.json and did npm install. How to resolve this?

angular-cli.json

angular-cli.json

        "styles": [
            "styles.css",
            "../node_modules/bootstrap/dist/css/bootstrap.css"
        ]

package.json

package.json

 "dependencies": {
    "bootstrap": "^4.0.0-beta.2"
 }

推荐答案

  1. 无需更新或重新安装引导程序,只需执行下面提到的步骤即可为您工作

  1. No need to update or reinstall your bootstrap just do below mentioned step it will work for you

在styles数组中打开angular-cli.json并指定引导程序的路径,如下所示:

open angular-cli.json inside styles array and specifying the path of bootstrap like this:

Angular-cli.json:

Angular-cli.json:

"styles": [
    "./node_modules/bootstrap/dist/css/bootstrap.min.css",
    "styles.css"
],

  • 打开您的style.css并将其粘贴在顶部:

  • Open your style.css and paste this at the top:

    @import url("../node_modules/bootstrap/dist/css/bootstrap.min.css")    
    

  • 这篇关于Bootstrap样式不适用于我的angular 2项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆