Trying to adjust the height & width of an image, but the CSS isn’t recognising the class/isn’t working.
I know my class method is different to my other classes, but when I try and make it the same, it gives a error message.
I’m using the Ruby language. It’s probably going to be something simple, but I’m too new at this to understand.
Also having a problem with Twitter bootstrap rows. I’ll be forever grateful if you can see anything wrong with that too.
HTML is:
<div class="container">
<div class="row">
<div class="col-md-3">
<%= image_tag @user.profile.avatar.url, class: 'lego-man' %>
</div>
<div class="col-md-6">
<h1><%= @user.profile.first_name %> <%= @user.profile.last_name %></h1>
<h3><%= @user.profile.job_title %></h3>
<div class="well">
<h3>Decription</h3>
<%= @user.profile.description %>
</div>
<% if current_user.plan_id == 2 %>
<div class="well">
<h3>Contact Information</h3>
<%= @user.profile.phone_number %><br/>
<%= @user.profile.contact_email %><br/>
</div>
<% end %>
</div>
</div>
</div>
CSS is:
.lego-man {
width: 128px;
height: 128px;
}
4
Answers
can you try like this
For reference
Click here:- https://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag
Just make sure the
CSS
code you are writing is properly loading.In rails, three methods are available to add your css styles.
Add this style property Inline in image_tag
Add this style property internally in same file using
<style>
tagsAdd this css property externally in app/assets/stylesheets/application.css
try using over ride your class.
and then add
<%= stylesheet_link_tag 'application', media: 'all' %>
to application layout