I'm having trouble in styling the bootstrap button group using button_to.
As shown above, I would like to have something like in the bottom, but currently I'm having a problem with button with "4" when using "button_to" helper.
My code looks like this:
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-default">1</button>
<button type="button" class="btn btn-default">2</button>
<button type="button" class="btn btn-default">3</button>
<%= button_to "4", {:action => "new", :id => 1}, :class => "btn btn-default" %>
<button type="button" class="btn btn-default">5</button>
<button type="button" class="btn btn-default">6</button>
</div>
please help me to fix it.
I ended up with following code. It works fine, now.
<%= link_to "4", {:action => "new", :id => 1}, class: "btn btn-default", role: "button" %>
The rails form helper button_to
generates a form around the button element, and this form has css of display:block
I solved this by adding this css:
div.btn-group form{
display: inline;
}
What about setting the div's styling to display: inline?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With