Reputation: 871
image_tag('batman.png' size:'100%xauto')
The size 100% x Auto is ignored as it does not follow the convention outlined in the Rails API.
Is there a way to do this in rails without the need of a global / specific css class?
Upvotes: 10
Views: 26654
Reputation: 10885
best way is
<%= image_tag avatar , height: 'value' , width: 'value can be auto or 30' %>
Upvotes: 0
Reputation: 409
This works:
<%= image_tag 'image_url', style: 'height:100%; width:auto;' %>
But if you don't want to write your styles inline, then you can use a class
instead:
<%= image_tag 'image_url', class: 'some-class-name' %>
Upvotes: 0