无法覆盖bootstrap.min.css

时间:2017-06-18 11:58:41

标签: html css twitter-bootstrap

我正在尝试使用我自己的自定义css覆盖bootstrap.min.css,但它没有发生。我错过了什么吗?这是我的HTML代码

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="{% block sb_admin_description %}{% endblock sb_admin_description %}">
    <meta name="author" content="{% block sb_admin_author %}{% endblock %}">
    <title>Wireless Dashboard</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/css/sb-admin.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->


</head>

<body>

    <div id="wrapper">
        <!-- Navigation -->
        <!-- Navigation -->
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a href="http://example.com/" target="_blank"><img src= "{% static "a.png" %}" alt="" width=80px></a>
            </div>
        <a class="navbar-brand"></a>
        <a class="navbar-brand"></a>
        <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
        <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
        <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
        <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>
                <a class="navbar-brand"></a>

        <a class="navbar-brand"><b><font size="6"> Wireless Dashboard</font></b></a>

我的CSS文件是:

.navbar-brand {
    float: center;
    height: 50px;
    padding: 15px 15px;
    font-size: 28px;
    line-height: 20px;
}

.navbar-inverse .navbar-brand {
    color: #FFFFFF;
}




.nav.navbar-nav.side-nav
{
    background: #1E395F;
}

/*****Navbar****/
.navbar-inverse .navbar-brand
{
    color: #99999;
}
.navbar-inverse .navbar-nav>li>a
{
    color: #FFFFFF;
    font-weight: 300;
    letter-spacing: 0.5px;
}

我如何获得1E395F颜色的navabar?目前根据bootstrap.min.css显示#99999

3 个答案:

答案 0 :(得分:0)

我没有密切关注你的css,但通常,要覆盖bootstrap,你必须在你的样式中添加!important

答案 1 :(得分:0)

你可以尝试在你的css属性中使用!important,或者将你的css代码放在页脚中(这样它在bootstrap之后加载)。

答案 2 :(得分:0)

我发现了django的问题。当我使用127.0.0.1:8000的runserver时,它无法正常工作。我改变到不同IP地址的那一刻起作用了。