Вопрос

I'm really new to HTML and I want to achieve the following thing:

<div class="column_1"></div>
<div class="column_2"></div>
<div class="column_3"></div>
<div class="column_4"></div>

I tried this one

  - (1..4).each do |i|
    .column #{i}

This generates the columns but the increment is in the content from the div and not part of the class name.

Hope someone can help me to show me the correct way ;)

Это было полезно?

Решение

You can’t use the CSS style syntax (. and #) to generate dynamic attributes like that, you need to do it like this:

- (1..4).each do |i|
  %div{:class => "column_#{i}"}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top