【问题标题】:css in combination with rails 3 cocoon gemcss与rails 3 cocoon gem结合
【发布时间】:2011-04-25 08:26:10
【问题描述】:

我想调整我用宝石茧制作的导轨中链接的位置,在我的源代码中我得到了这个:

    <div class="fields">
    <a href="#" class="add_fields" data-association="answer" data-template="    &lt;div class=&quot;nested-fields&quot;&gt;
            &lt;label for=&quot;question_answers_attributes_new_answers_answer&quot;&gt;Answer&lt;/label&gt;
          &lt;input id=&quot;question_answers_attributes_new_answers_text&quot; name=&quot;question[answers_attributes][new_answers][text]&quot; size=&quot;30&quot; type=&quot;text&quot; /&gt;
            &lt;input id=&quot;question_answers_attributes_new_answers__destroy&quot; name=&quot;question[answers_attributes][new_answers][_destroy]&quot; type=&quot;hidden&quot; /&gt;&lt;a href=&quot;#&quot; class=&quot;remove_fields dynamic&quot;&gt;Remove&lt;/a&gt;
    &lt;/div&gt;

">Add Answer</a>
    </div>

有谁知道如何在 CSS 中调用“添加答案”链接?我试过了:div.fields.add_fields a { css: code; }

但这似乎没有任何作用......

问候, 泰斯

【问题讨论】:

  • 只写'div.fields a.add_fields {css:code}'

标签: ruby-on-rails-3 css cocoon-gem


【解决方案1】:

这是一个简单的 CSS 问题。简单的

a.add_fields {}

选择类add_fields 的所有a。 只是

.add_fields {}

通常也足够了。

但如果你想真正严格,你可以写:

.fields a.add_fields {}

上面写着:类 .fields 的东西并嵌套了 a.add_fields 的元素。

您甚至可以声明它必须是直系子代:

.fields > a.add_fields {}

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2016-06-09
    • 2016-04-04
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多