我关注了this turotial作为 Laravel 基础学习。我执行了composer require说明/html
。为了在我的元素中导入 Bootstrap ,在“providers”中,我添加了
Illuminate\View\ViewServiceProvider::class,
Illuminate\Html\HtmlServiceProvider::class,
另外,我补充说
'Form'=> Illuminate\Html\FormFacade::class,
'Html'=> Illuminate\Html\HtmlFacade::class,
但是 Bootstrap 似乎不起作用。
{!! Form::open() !!}
<div class="form-group">
{!! Form::label("name : ", "Your name") !!}
{!! Form::text("username", null, ["class"=>"form-control"]) !!}
</div>
{!! Form::close() !!}
文本字段没有像预期的那样拉伸(stretch)到页面宽度。
知道为什么会这样吗?或任何其他替代解决方案?
最佳答案
您需要在 html 模板文件中包含 Bootstrap 的链接。
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div id = "container">
@yield("content")
</div>
</body>
</html>
关于php - Bootstrap 在 laravel5 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32695987/