如何在 PhpStorm 中使用 Bootstrap?

How to use Bootstrap in PhpStorm?

如何在 PhpStorm 中使用 Bootstrap?

我确实使用 npm 安装了 Bootstrap,但是如果我在 index.php 中编写一个简单的 bootstrap 命令 它只是一个简单的不受影响的灰色小按钮。

例如一个按钮:

<button class="btn btn-primary">test</button> 

我在 PhpStorm 中缺少什么?

您必须 link 通过 <link> 标签将 *.css 文件添加到您的页面,例如 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css">。 请检查 tutorial and the cheatsheet - you may find these resources helpful. See also https://www.jetbrains.com/webstorm/guide/tips/library-completion/

步骤 1(如果您使用 CDN 库): 第 2 步: 转到设置 -> 语言和框架 -> Javascript -> 库并检查是否启用 'Bootstrap'(如果尚未启用)。