gpt4 book ai didi

html - 包装 link_to、image_tag 和 div_tag 以生成此代码时出错

转载 作者:太空宇宙 更新时间:2023-11-04 10:07:04 28 4
gpt4 key购买 nike

我有一个简单的 HTML 代码,需要用 Ruby 进行转换。

<div class="col-md-4 col-sm-6">
<div class="single-work">
<a class="work-thumb mb-35 light-box" href="works/img-05.jpg">
<%= image_tag 'works/img-05.jpg' %>
<div class="work-hover"></div>
</a>
<div class="work-excerp">
<a href="single-services.html"><h2>Plugin Development</h2></a>
<p>Duis autem vel eum iriure dolor in hendrerit in vulpu tate velit esse molestie consequat.</p>
</div>
</div>
</div>

这是我的 Ruby 代码。

<div class="col-md-4 col-sm-6">
<div class="single-work">
---> <%= link_to((image_tag'works/img-05.jpg'), image_path('works/img-05.jpg'), 'class' => 'work-thumb mb-35 light-box') %>
<div class="work-hover"></div>
<div class="work-excerp">
<a href="single-services.html"><h2>3D Design</h2></a>
<p>Duis autem vel eum iriure dolor in hendrerit in vulpu tate velit esse molestie consequat.</p>
</div>
</div>
</div>

我需要这个 <div class="work-hover"></div>在该标签内(寻找这个 --> 箭头)

最佳答案

你可以这样做:

<div class="col-md-4 col-sm-6">
<div class="single-work">
<%= link_to( image_path('works/img-05.jpg'), class: 'work-thumb mb-35 light-box') do %>
<%= image_tag 'works/ing-05.jpg' %>
<div class="work-hover"></div>
<% end %>
<div class="work-excerp">
<a href="single-services.html"><h2>3D Design</h2></a>
<p>Duis autem vel eum iriure dolor in hendrerit in vulpu tate velit esse molestie consequat.</p>
</div>
</div>
</div>

关于html - 包装 link_to、image_tag 和 div_tag 以生成此代码时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37914693/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com