简体   繁体   中英

Django: Bootstrap classes loading but not my style.css

Here is my HTML file:

{% load static %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>{% block title %}{% endblock %}</title>

    <!-- Link to Bookstrap and stylesheet -->
    <link rel='stylesheet' href="{% static 'css/bootstrap.min.css' %}">
    <link rel='stylesheet' href="{% static 'css/style.css' %}">
    <script src="{% static 'js/bootstrap.min.js' %'}"></script>

  </head>
  <body class="bg-blue">

    <div class="container">
      <div class ="row">
        <div class ="col-lg-4 col-lg-offset-4">
          <br/>
          <br/>
          <br/>
          <div class="panel panel-body">
            <div class="panel-body">
              <h3 class="text-center text-uppercase"><b> {% block heading %}{% endblock %}</b></h3>
              <br/>
              {% block content %}{% endblock %}
          </div>
        </div>
      </div>
  </body>
</html>

I want to use the "bg-blue" class defined in my style.css.

.bg-blue{
  background-color: #3F3F63;
}

However it doesn't work. My boostrap and style.css are in the same folder. The Bootstrap loads, for example my text in centered and uppercase and the font is different.

I've also tried putting the class directly in the html file, and that works, but I want to be able to use style.css.

Edit: it works in Firefox but not Chrome, so it's not the code, any explain to this?

that is because you forgot to clear cache in chrome.press control + F5 to clear cache and load again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM