I have a rails app where a user can search for a place name and when after they search an image is loaded onto the same page. I would like it so that my search box is centered vertically and horizontally and is in the middle of the page. Once a search is made an image is loaded to the same page and I would like this to appear under the search box, with the search box now being at the top. Basically the HTML for the image is added when a button is pressed and it should then look like the second image. Excuse my poor attempt at showing this in two images. How do I achieve this?
Here is my HTML code:
<div class="page-wrapper">
<h1 class="title">The weather in GIFs</h1>
<div class="search">
<%= form_tag(current_weather_forecasts_path, method: :get) do %>
<%= text_field_tag :q, nil, placeholder: "Enter a city", class: "search-field" %>
<%= button_tag type: 'submit', class: "search-button" do %>
<i class="fas fa-search"></i>
<% end %>
<% end %>
</div>
<% if @forecasts_facade.invalid_city? %>
<p>Please use a valid city name!</p>
<% elsif @forecasts_facade.missing_city? %>
<p>Please type in a city name!</p>
<% elsif @forecasts_facade.forecast == {} %>
<% else %>
<p class="weather-description"><%= "#{@city.capitalize}: #{@forecasts_facade.description}" %></p>
<div class="gif-container"><%= image_tag(find_gif_url, class: "gif") %>
<span class="temperature weather-attribute"><%= "#{@forecasts_facade.temperature}°C" %></span>
<span class="wind weather-attribute"><%= "wind:#{(@forecasts_facade.wind * 3.6).to_i}km/h" %></span> <!-- converts to km/hr -->
<span class="humidity weather-attribute"><%= "humidity:#{@forecasts_facade.humidity}%" %></span>
</div>
<% end %>
</div>