CSS 如何向 Laravel 4 表单添加类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17284985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add classes to Laravel 4 Forms
提问by Lynx
Probably, it is a simple answer but I cannot find any documentation regarding this. I have laid out a form using Laravel 4 and it seems to be working fine but now I need to style it. How can I add classes to the form when its using blade?
也许,这是一个简单的答案,但我找不到任何关于此的文档。我已经使用 Laravel 4 布置了一个表单,它似乎工作正常,但现在我需要对其进行样式设置。使用刀片时如何向表单添加类?
{{ Form::open(array('url' => 'foo/bar')) }}
I have a class set up for the form and the buttons but I am not sure how to add it to the blade template.
我为表单和按钮设置了一个类,但我不确定如何将它添加到刀片模板中。
回答by The Alpha
You may try this
你可以试试这个
{{ Form::open(array('url' => url('foo/bar'), 'class'=>'form', 'id'=>'frmFoo', 'style'=>'border:solid gray 1px')) }}
You can add inline style, class, id etc.
您可以添加内联样式、类、id 等。
回答by Remluben
As far as I know, you can easily pass additional attributes to the open() methods argument:
据我所知,您可以轻松地将附加属性传递给 open() 方法参数:
echo Form::open(array('url' => 'foo/bar', 'method' => 'put', 'class' => 'form-bootstrap'))
Check out the L4 docs for more information http://laravel.com/docs/html
查看 L4 文档以获取更多信息http://laravel.com/docs/html