BOOTSTRAP CDN 托管,额外 CSS

BOOTSTRAP CDN Hosted, additional CSS

我正在通过 MAXcdn 托管的 CDN 使用 BOOTSTRAP。但是现在我想更改 CSS 文件中的某些内容,但它不在我的服务器上。

所以我的问题是,当您通过 CDN 解决方案嵌入文件时,如何处理额外的 CSS?

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

创建一个名为 custom.css 的新文件并将其包含在 CDN 版本之后的 <head></head> 中。

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Your Custom theme -->
<link rel="stylesheet" href="your/path/to/custom/css/file">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

最好的解决方案是将 bootstrap.css 文件中的 CSS 规则覆盖到 custom.css 文件中。

例如

如果您在 Bootstrap 的 (bootstrap.css), 之后包含您的 css (custom.css),您可以通过重新定义它们来覆盖规则。

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Your Custom CSS code should go in this file-->
<link rel="stylesheet" href="css/custom.css">

提示:确保在 bootstrap CDN 文件之后将 custom.css 文件添加到您的 HTML 文档中。