Display all Tags helppp!

 <% @tags.each do |t| %>
  <div class="card col-xs-4">

<%= image_tag t.image %>

<%= t.title %>

<% end %>

In this code, I have couple of doubts..I understand in tags we are iterating over each element and getting it's image and title..but why me give "image_tag" in 3rd line.
Also wat do we mean by command

in 2nd line?


you do not have a problem getting through the exercise?

when you want to use a image in html, you need to use the image tag:


so, ruby use image_tag, so it knows it need to use a html image tag (<img>). Does that make sense? ruby converts image_tag into <img>

you also have doubts over this line:

<div class="card col-xs-4">

i don't know what card does, you will have to check your css file, but col-xs-4 sounds like a class you would use in bootstrap, for a grid system. grid system are really nice to make your site responsive. col-xs is used for small screens (smaller then 768px), the total number of cols is 12, so col-xs-4 would be 1/3 of the screen width

edit, card doesn't seem to do much special:

.card {
  color: #fff;
  display: block;
  margin: 4px 0;

You do understand html and css right?


I learnt HTML CSS before starting Ruby on Rails...so i knw bit of stuff.
Thanks a lot..couldn't hv askd for better explanation dan dis :smile:


well, if you know a bit of html and css, .card should be a piece of cake, you know why you need a <img> tag display a image on the page, and if you are interested, you can read a bit about css grid system here so you understand what col-xs-4 does


Yaa I was clear with in html but got confuse dhere wd image_tag..thanks a lot..i willl go through it :smile: