2017-05-28 194 views
0

我使用Bootstrap jumbotron作爲我的網頁頭,我有我自己的layout.css,但並不是我所有的.jumbotron規則都在工作。當我嘗試設置margin-bottom: 0px;時,它並沒有出現在我的瀏覽器開發工具中,甚至沒有出現。有誰知道如何解決這一問題?CSS沒有顯示所有規則

的index.html - 頭和報頭與超大屏幕類:

<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> 
    <link href="{{ url_for('static', filename='css/layout.css') }}" rel="stylesheet"> 
</head> 

<header class="jumbotron container-fluid"> 
    <h1> Catalog App </h1> 
    <button type="button" class="btn btn-xs btn-default btn-login" onclick="location.href='/login/'">Login</button> 
</header> 

layout.css中 - .jumbotron:

.jumbotron { 
    background-color: #195e8c; 
    margin-bottom: 0px; 
    padding-top: 2px; 
    padding-bottom: 2px; 
} 

開發工具 - 未示出下邊距:

Chrome Developer tools

我確保一切都保存並重新加載服務器。它在一個簡單的Flask python服務器上運行,如果這樣的話。

+0

嘗試把你的CSS文件引導CSS – BigMonkey89WithaLeg

+0

可以重現它爲我們以後? –

+0

@ BigMonkey89WithaLeg它們已經在引導後鏈接CSS –

回答

0

瓶不重裝CSS文件,因爲在我的server.py文件layout.css中是靜態的,當應用程序爲它設置一次第一套。我再次設置了FLASK_APP並重新加載了服務器,並解決了問題。

要具有長頸瓶服務器更新包括CSS關掉你的瀏覽器緩存,然後打開燒瓶調試export FLASK_DEBUG=1

0

嘗試添加!important你的保證金財產

.jumbotron { 
    background-color: #195e8c; 
    margin-bottom: 0px !important; 
    padding-top: 2px; 
    padding-bottom: 2px; 
} 
+0

我在另一個類似的帖子中看到了這個解決方案,但他們警告不要使用它,並且說永遠不要使用它,除非父母使用它(我檢查了bootstrap.css並且它沒有使用!important),使用它的潛在問題是什麼!important ? 編輯:測試了這一點,邊緣底部的規則仍然沒有顯示 –

+0

很多引導CSS的默認屬性需要重寫'!重要'。我認爲沒有任何相關的問題,如果您需要再次覆蓋它,則只需使用'!important'。 – vlk

+0

我測試過了,它仍然沒有顯示在瀏覽器或開發人員工具中 –