Reputation: 628
I'm using laravel to create a form styled with bootstrap css.
{!! Form::open(['url' => '/hold', 'method' => 'POST', 'class' => 'form-horizontal']) !!}
<div class="form-group">
{!! Form::label($detail->name, NULL, array('class'=>'control-label')) !!}
{!! Form::text('detail['.$detail->name.']', null, ['class' => 'controls']) !!}
</div>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
{!! Form::submit('Hold', ['class'=>'btn btn-danger', 'style' => 'float:right;']) !!}
{!! Form::close() !!}
According to Chrome dev tools, the css selector that is overriding the .btn style rules is button, html input[type="button"], input[type="reset"], input[type="submit"]
I'm guessing that the html input
class takes precedence over the btn
class. I do not know how to prevent this and force btn
to take precedence.
Upvotes: 0
Views: 1106
Reputation: 7869
Wrap the whole form with a div that has a custom class - call it .form-container
- and then override the style within the custom container. This is super easy if you are using Sass, not much harder if you are using CSS though.
HTML - just add custom class:
{!! Form::open(['url' => '/hold', 'method' => 'POST', 'class' => 'form-horizontal form-container']) !!}
<div class="form-group">
{!! Form::label($detail->name, NULL, array('class'=>'control-label')) !!}
{!! Form::text('detail['.$detail->name.']', null, ['class' => 'controls']) !!}
</div>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
{!! Form::submit('Hold', ['class'=>'btn btn-danger', 'style' => 'float:right;']) !!}
{!! Form::close() !!}
Sass:
.form-container {
input[type="reset"] {
// style here
}
}
CSS:
.form-container input[type="reset"] {
// style here
}
Upvotes: 3
Reputation: 133380
try adding .btn-sm in your button
<button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">Close</button>
Upvotes: 0