如何在我的刀片文件中正确链接我的css文件?我试过import { bootstrap } from "angular2/platform/browser"
import { ROUTER_PROVIDERS } from "angular2/router"
import { ExternalService} from "./utils/external.service"
import { AppComponent } from "./app.component"
import { HTTP_PROVIDERS } from "angular2/http"
bootstrap(AppComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS, ExternalService, provide(LocationStrategy, {useClass: HashLocationStrategy})])
,但没有为我工作。我创建了一个子页面,其中包含导航栏以及同一文件夹中的css文件。所以它们位于模板的(部分)文件夹子文件夹下。
navigation.blade.php
<link rel = "stylesheet" type = "text/css" href = "navigation.css">
navigation.css
<link rel = "stylesheet" href= "{{ URL::asset('assets/css/bootstrap.min.css')}}">
<div class = "navbar navbar-default">
<ul>
<li>
<a href = "#">Login</a>
<a href = "#">Register</a>
</li>
</ul>
</div>
答案 0 :(得分:2)
您需要在样式表中添加另一个<link>
。那会得到你的css文件。 (如果它与bootstrap.min.css
在同一目录上,这将有效)
<link rel = "stylesheet" href= "{{ URL::asset('css/navigation.css')}}">
所以你的代码将是:
<link rel = "stylesheet" href= "{{ URL::asset('css/bootstrap.min.css')}}">
<link rel = "stylesheet" href= "{{ URL::asset('css/navigation.css')}}">
<div class = "navbar navbar-default">
<ul>
<li>
<a href = "#">Login</a>
<a href = "#">Register</a>
</li>
</ul>
</div>
您的文件夹结构:
public/css
public/images
public/fonts
public/js
希望这有效!