2017-03-09 80 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