我的文件夹结构是这样的
索引.html css/样式.css
HTML代码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading">Panel heading without title</div>
<div class="panel-body">
Panel content
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading panel-heading-custom">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</body>
</html>
css/样式.css
@import url('//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css');
.panel-default > .panel-heading-custom {
background: #ffaa00; color: #aaa;
}
但是,面板颜色似乎根本没有改变。显然它适用于这个 jsfiddle,我复制并粘贴了代码。
最佳答案
只需在此序列中包含文件。
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css" />
styles.css
在 bootstrap.min.css
之后,因为 bootstrap css 覆盖了样式 css。
关于jquery - Css 未导入到 html 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34555503/