【发布时间】:2015-06-21 07:47:29
【问题描述】:
我希望在表单旁边显示一张图片。这是我尝试过的。
CSS 文件:
.il {
display:inline;
padding: 0px;
margin: 0px;
}
new.html.erb
<div class="il">
<%= image_tag("successful_forex_trader.jpg", :alt => "Forex Money Manager") %>
<div class="small-6 large-centered columns">
<%= form_for(@investor) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<fieldset>
<legend> Enter your best details</legend>
<%= f.label :name %>
<%= f.text_field :name, :placeholder => "John Doe" %> </br>
<%= f.label :email %>
<%= f.text_field :email, :placeholder => "you@example.com" %></br>
<%= f.label :country %>
<%= f.text_field :country %></br>
<%= f.label :phone %>
<%= f.text_field :phone, :placeholder => "" %></br>
<%= f.submit "I'm interested!", :class => 'button radius' %>
</fieldset>
<% end %>
</div>
</div>
生成的html代码:
<div class="il">
<img alt="Forex Money Manager" src="/assets/successful_forex_trader-a46ac55676d8bd8789095d2e5ebbef0c588692b25c6d8d3da51b32efa6fd2435.jpg" />
<div class="small-6 large-centered columns">
<form class="new_investor" id="new_investor" action="/investors" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="authenticity_token" value="n10HveoPkQJz0n5llHZgPO7hlgiUhoOgFWOfW28SoKn9/YwRtFLZC5+8bFl0Ywy0gOStDirJ+6gmLB7wHA==" />
<fieldset>
<legend> Enter your best details</legend>
<label for="investor_name">Name</label>
<input placeholder="John Doe" type="text" name="investor[name]" id="investor_name" /> </br>
<label for="investor_email">Email</label>
<input placeholder="you@example.com" type="text" name="investor[email]" id="investor_email" /></br>
<label for="investor_country">Country</label>
<input type="text" name="investor[country]" id="investor_country" /></br>
<label for="investor_phone">Phone</label>
<input placeholder="+48111111111" type="text" name="investor[phone]" id="investor_phone" /></br>
<input type="submit" name="commit" value="I'm interested!" class="button radius" />
</fieldset>
</form>
</div>
</div>
但是,当您访问我的实时站点时,您会看到图像位于表单上方。我做错了什么? https://infinite-oasis-2303.herokuapp.com/investors/new
【问题讨论】:
标签: html css ruby-on-rails zurb-foundation-5