Angular 引导样式未将div放入行中

Angular 引导样式未将div放入行中,angular,typescript,bootstrap-4,Angular,Typescript,Bootstrap 4,我在我的角度应用程序中使用引导。我在Index.html中有它,如下所示: <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css"> 尽管如此,当我的应用程序中有下面的代码时,每一列都在不同的行中,而不是在同一行中 <div class="container"> <div class="row"> <div class="col-sm"&g

我在我的角度应用程序中使用引导。我在Index.html中有它,如下所示:

<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
尽管如此,当我的应用程序中有下面的代码时,每一列都在不同的行中,而不是在同一行中

<div class="container">
  <div class="row">
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
  </div>
</div>

三列之一
三列之一
三列之一
下面是我在应用程序中获得的内容的屏幕截图:

任何帮助都将不胜感激。

请将您的班级“col-sm”替换为“col-sm-4”。
您需要提供所需的列数(带有适当的.col--classes的标记)

请将您的类“col-sm”替换为“col-sm-4”。

您需要提供所需的列数(带有适当的.col--class的标记)

您需要
@import'~bootstrap/dist/css/bootstrap.min.css'
style.css
而不是index.html文件中的链接标记(重要

另外,在
angular.json
中的
style
部分,您需要将bootstrap.css定义为

"styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
]
并确保安装引导程序4以使用
col sm

我的示例
angular.json
在项目中


您需要
@import'~bootstrap/dist/css/bootstrap.min.css'
style.css
而不是index.html文件中的链接标记(重要

另外,在
angular.json
中的
style
部分,您需要将bootstrap.css定义为

"styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
]
并确保安装引导程序4以使用
col sm

我的示例
angular.json
在项目中


从npm安装引导程序4和jQuery

$ npm install --save bootstrap jquery
打开angular.json文件,将引导CSS和JS文件以及jQuery的文件路径添加到构建目标下的样式和脚本数组中

 "architect": {
  "build": {
    [...], 
    "styles": [
      "src/styles.css", 
        "node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],
      "scripts": [
        "node_modules/jquery/dist/jquery.min.js",
        "node_modules/bootstrap/dist/js/bootstrap.min.js"
      ]
    },
如果需要三行,请使用
而不是


如果需要自定义行,请参阅此项。

从npm安装Bootstrap 4和jQuery

$ npm install --save bootstrap jquery
打开angular.json文件,将引导CSS和JS文件以及jQuery的文件路径添加到构建目标下的样式和脚本数组中

 "architect": {
  "build": {
    [...], 
    "styles": [
      "src/styles.css", 
        "node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],
      "scripts": [
        "node_modules/jquery/dist/jquery.min.js",
        "node_modules/bootstrap/dist/js/bootstrap.min.js"
      ]
    },
如果需要三行,请使用
而不是


如果您需要自定义行,请参阅。

我刚刚将“col-sm-4”替换为“col-sm-4”,仍然得到相同的结果。请进入浏览器开发工具,检查元素并检查引导css类是否正确显示。我刚刚将“col-sm-4”替换为“col-sm-4”请进入浏览器开发工具,检查元素并检查引导css类是否正确显示。您需要多少行您需要多少行