{{ Form...">

Loading tray: drag left and right in the panel footer

I have a Bootstrap panel with two buttons in the footer:

<div class="panel-footer"> {{ Form::open( array('route' => array('dogs.edit', $dog->id), 'method' => 'get', "class" => 'col-lg-6 ')) }} {{ Form::submit("Edit", array('class' => 'btn btn-default')) }} {{ Form::close() }} {{ Form::open( array('route' => array('dogs.destroy', $dog->id), 'method' => 'delete', "class" => 'col-lg-6 ')) }} {{ Form::submit("Delete", array('class' => 'btn btn-default')) }} {{ Form::close() }} </div> 

The forms for each of the buttons have the pull-left and pull-right classes, so that each of them will move on both sides of the panel footer.

The float works, but now the buttons are outside the footer:

enter image description here

I tried using a grid instead of pull helpers, but I got the same result.

I also looked for a solution (this should be fairly common, I think) and did not find explanations that do not require overriding Bootstrap with custom css.

Is it possible to fix this with Bootstrap only or will I need to reset my own CSS to fix it?

+57
html css twitter-bootstrap
May 26 '14 at 14:49
source share
4 answers

Just add div with clearfix after buttons

<div class="clearfix"></div>

+97
May 26 '14 at 14:52
source share

Stalin's answer is correct, but you can use a different approach, more elegant

From Bootstrap Document ( #clearfix )

Easily clear floats by adding .clearfix to the parent element.

Just add clearfix to the parent div:

 <div class="panel-footer clearfix"> {{ Form::open( array('route' => array('dogs.edit', $dog->id), 'method' => 'get', "class" => 'col-lg-6 ')) }} {{ Form::submit("Edit", array('class' => 'btn btn-default')) }} {{ Form::close() }} {{ Form::open( array('route' => array('dogs.destroy', $dog->id), 'method' => 'delete', "class" => 'col-lg-6 ')) }} {{ Form::submit("Delete", array('class' => 'btn btn-default')) }} {{ Form::close() }} </div> 
+67
Aug 05 '14 at 17:54 on
source share

just add the text-right class in the div panel

+9
Feb 24 '16 at 22:57
source share

It seems strange to me that .panel-footer is not already included in the clearfix css library as .panel-body and even .modal-footer do. Instead of remembering to throw the clearfix class on any footer (if you have a lot, it might be a pain), it's better to just add clearfix css to .panel-footer in your main CSS or edit the library directly.

 .panel-footer:before, .panel-footer:after { display: table; content: " "; } .panel-footer:after { clear: both; } 
+4
Aug 03 '16 at 1:50
source share



All Articles