在navbar laravel的背景颜色

时间:2017-11-03 08:08:57

标签: css laravel colors background-color

我正在尝试使我的导航栏颜色为蓝色,但出于某种原因,有两个部分是白色的,当我尝试使用background: lightblue;时我想让它们完全变成蓝色但是由于某种原因它不会工作。 (见截图)任何人都可以帮助我吗?提前致谢

以下是发生的事情的屏幕截图: enter image description here

这是导航栏(app.blade.php)所在的位置:

    <!DOCTYPE html>
    <html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>

        <!-- Styles -->
        <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    </head>
    <body>
        <div id="app">
            <nav class="navbar navbar-default navbar-static-top">
                <div class="container">
                    <div class="navbar-header">

                        <!-- Collapsed Hamburger -->
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
                            <span class="sr-only">Toggle Navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
    <html>
<head>
                <title>SideBar Menu</title>
         <link href="{{ asset('css/style.css') }}" rel="stylesheet">
    </head>
    <body>

        <div id="sidebar">

            <ul>
                <li><a href="{{route('home')}}">Home</a></li>        
                <li><a href="{{route('deleted_result')}}">Deleted Records</a></li>
            </ul>

            <div id="sidebar-btn">
                <span></span>
                <span></span>
                <span></span>
            </div>

        </div>


        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script>

        $(document).ready(function(){
            $('#sidebar-btn').click(function(){
                $('#sidebar').toggleClass('visible');
            });
        });

        </script>
 </body>
    </html>

                        <!-- Branding Image -->
                        <a class="navbar-brand" href="{{ url('/') }}">
                            {{ config('app.name', 'Laravel') }}
                        </a>
                    </div>

                    <div class="collapse navbar-collapse" id="app-navbar-collapse">
                        <!-- Left Side Of Navbar -->
                        <ul class="nav navbar-nav">

                            &nbsp;
                        </ul>

                        <!-- Right Side Of Navbar -->
                        <ul class="nav navbar-nav navbar-right">
                            <!-- Authentication Links -->
                            @guest
                                <li><a href="{{ route('login') }}">Login</a></li>
                                <li><a href="{{ route('register') }}">Register</a></li>
                            @else
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true">
                                        {{ Auth::user()->name }} <span class="caret"></span>
                                    </a>

                                    <ul class="dropdown-menu">
                                        <li>
                                            <a href="{{ route('logout') }}"
                                                onclick="event.preventDefault();
                                                         document.getElementById('logout-form').submit();">
                                                Logout
                                            </a>

                                            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                                {{ csrf_field() }}
                                            </form>
                                        </li>
                                    </ul>
                                </li>
                            @endguest
                        </ul>
                    </div>
                </div>
            </nav>

            @yield('content')
        </div>

        <!-- Scripts -->
        <script src="{{ asset('js/app.js') }}"></script>
    </body>
    </html>

这是我使用的style.css

#navbar-toggle collapsed{
    background:#ADD8E6;

}

#navbar-header{
    background:#ADD8E6;
}

2 个答案:

答案 0 :(得分:2)

而不是样式#navbar-header.navbar

中添加css
.navbar {
    background:#ADD8E6;
}

答案 1 :(得分:0)

将#navbar-header 改成.navbar,如果还是不行,在.navbar 类上添加!important 子句

.navbar {
    background-color: blue; !important;
}