I want an image to appear right beside a form. This is what I am have tried.
CSS file:
.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 => "[email protected]" %></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>
Generated html code:
<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="[email protected]" 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>
But when you got to my live site, you see the image is way above the form. What could I have done wrong? https://infinite-oasis-2303.herokuapp.com/investors/new
The CSS
display:inline
is being applied on the container, not on it's elements. One approach is to just float the<img>
usingclass=left
and move it alongside the<form>
, inside the centered div.