2017-03-09 77 views
0

我正在烧瓶中制作Web应用程序,并在我的前端使用引导程序。外部CSS文件位于应用程序的/静态。问题是外部CSS中的属性不适用于元素。外部CSS文件在引导程序中不起作用

form.html

<head> 
    <!-- Latest compiled and minified CSS --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 

    <!-- Optional theme --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 

    <link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet"> 
</head> 

form.html

<div class="jumbotron"> 
    <div class= "container"> 
     <h1>Application</h1> 
    </div> 
</div> 

的style.css

.jumbotron { 
    background-color: #191970; 
    height: 100px; 
} 
+0

您是否在浏览器控制台中看到任何错误? – DavidG

+0

@DavidG不,浏览器控制台没有错误! – Pooneh

回答

0

(我无法评论,但如此...)从Configuring Flask to correctly load Bootstrap js and css files

尝试使用:

<link href="{{ url_for('static', filename='scripts/bootstrap/dist/css/bootstrap.css') }}" rel="stylesheet"> 

他们说这里的模式是:

{{ url_for('static', filename='path/inside/the/static/directory') }} 
0

尝试以这种方式解决:

<head> 

<!-- Latest compiled and minified CSS --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 

<!-- Optional theme --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 

<!-- Latest compiled and minified JavaScript --> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 

<link href="{{ url_for('static', filename='stylesheets/style.css') }}" rel="stylesheet" type="text/css"> 

</head> 

假设你所在的静态中的文件夹 “样式”文件夹,其中包含文件style.css