【问题标题】:How to isolate bootstrap 5?如何隔离引导程序 5?
【发布时间】:2021-09-17 16:50:26
【问题描述】:

我想将 bootstrap-5 样式隔离到某个特定的块、页面或 有人可以指导我如何将 bootstrap 5 隔离为 intire 页面或在某些特定的情况下。

【问题讨论】:

    标签: html sass less bootstrap-5


    【解决方案1】:

    添加保护类来包装你的包含:

    .bs-5 {
        @import (inline) "@{cssPath}/bootstrap.min.css"
    }
    

    然后做这个HTML结构:

    <div class="bs-5">
        /* .. BS5 specific content .. */
    </div>
    

    【讨论】:

      【解决方案2】:

      您可以使用此链接或自己自定义 saas
      https://github.com/onderakbulut/Isolated-Bootstrap-5

      • 从链接下载 bootstrap-5.0.1-iso.css
      • 将下载的 css 文件添加到您的项目中

      然后像这样添加代码sn-ps

      <!DOCTYPE HTML>
      <html lang="en-US">
      <head>
          <meta charset="UTF-8">
          <title></title>
          
          <link rel="stylesheet" href="https://gitcdn.link/repo/onderakbulut/Isolated-Bootstrap-5/main/bootstrap-5.0.1-iso.css" />
      
      </head>
      <body>
          
          
        
      <div class="bootstrap-iso">
          <!-- Bootstrap works only here-->
          <div class="container p-5 bg-warning">
              Bootstrap 5 İsolated
          </div>
      </div>
      
      </body>
      </html>

      【讨论】:

      • 请添加更多详细信息以扩展您的答案,例如工作代码或文档引用。
      猜你喜欢
      • 2018-01-15
      • 2021-12-26
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      • 2017-05-15
      • 2018-06-23
      • 1970-01-01
      • 2021-09-14
      相关资源
      最近更新 更多