0
我有一個main.blade文件,其中包含導航欄的部分內容,其中包含可在一頁以外的所有頁面上正常工作的CSS樣式。這個頁面和其他頁面之間的唯一區別是它是一個資源(使用CRUD控制器)。爲什麼我看不到導航欄的CSS?刀片不在特定頁面上使用導航欄的css風格
這裏是我的代碼:
main.blade
<!DOCTYPE html>
<html lang="en">
@include('partials._head')
<body>
@include('partials._nav')
<div class="container">
@yield('content')
</div>
@include('partials._javascript')
@yield('scripts')
</body>
</html>
的工作不頁:
@extends('main')
@section('content')
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1> Create New Post </h1>
<hr>
{!! Form::open(['route' => 'posts.store', 'data-parsley-validate' => '', 'files' => true]) !!}
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, array('class' => 'form-control','required' => '')) !!}
{!! Form::label('slug', 'Slug:')!!}
{!! Form::text('slug', null, array('class' => 'form-control',
'required' => '', 'minlength' => '5', 'maxlength' => '255')) !!}
{!! Form::label('category_id', 'Category:') !!}
<select class="form-control" name="category_id">
@foreach($categories as $category)
<option value='{{ $category->id }}'> {{ $category->name }}</option>
@endforeach
</select>
{!! Form::label('body', 'Post Body:') !!}
{!! Form::textarea('body', null, array('class' => 'form-control')) !!}
{!! Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px')) !!}
{!! Form::close() !!}
</div>
</div>
@endsection
_navbar.blade.php(包含在主)
<link rel="stylesheet" type="text/css" href="css/style1.css">
<link rel="stylesheet" type="text/css" href="css/color/rose.css">
<nav class=" nim-menu navbar navbar-default navbar-fixed-top">
<div class="container1">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Serv<span class="themecolor">i</span>ce</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
@if (Auth::check())
<li><a href="{{ route('dashboard') }}" class="active">Home</a></li>
<li><a href="{{ route('categories') }}">Categories</a></li>
<li><a href="{{ route('posts.create') }}">Create a Post</a></li>
<li><a href="{{ route('contact') }}">Contact Us</a></li>
<li><a href="#">Messages</a></li>
<li><a href="#">My Posts</a></li>
<li><a href="#">Logout</a></li>
@else
<li><a href="dashboard" class="active">Home</a></li>
<li><a href="categories">Categories</a></li>
<li><a href="createPost">Create a Post</a></li>
<li><a href="contact">Contact Us</a></li>
<li><a href="login">Login</a></li>
<li><a href="register">Register</a></li>
@endif
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
刪除相關的代碼,直到它再次出現,然後從那裏調試。最可能的問題是某種格式不正確的HTML元素或其他東西。 – Ohgodwhy
我對所有頁面使用相同的結構,但該頁面似乎是唯一一個不應用CSS的(顯示主刀片的導航欄,但不適用來自_navigation部分的CSS) – Andrew
使用always base url to鏈接你的CSS和JS文件。發佈你如何鏈接你的樣式 – webDev