I'm using Rails and Bootstrap and I'm trying to create large 100x100 pixel buttons with a large image at the top and text below.
I'm using the follwing code in the view (partial):
<button class="btn btn-large btn-vehicles btn-header-maint">
<%= image_tag ("glyphs/Vehicles.gif" , :size => "66x66") %>
<br></br>
<%= link_to( "Vehicles", :controller => 'vehicles') %>
</button>
The problem is that only the text is working as a link, not the whole button. I've messed around for hours trying to solve this. Can anyone help with the correct structure?
You can't nest links within <button>
tags.
You probably want to just use the link itself as the button, put the content inside it, and style it appropriately:
<%= link_to( "Vehicles", :controller => 'vehicles') do %>
<%= image_tag ("glyphs/Vehicles.gif" , :size => "66x66") %>
<br></br>
<% end %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.