Ysal Ysal - 4 months ago 12
CSS Question

How do I eliminate the whitespace between my title bar and the top of my page in my rails website

The problem

So I'm working on a rails website and I'm having a little design problem. It seems that this code for the devise gem is causing whitespace to appear between the titlebar and the top of the page.

<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>


Adding an if statement to the these classes gets rid of the problem in the landing page but it still persists in other pages.

<% if !(controller_name == "home" && action_name == "index") %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<% end %>


If anyone knows a workaround to this problem I would really appreciate it. Thanks!

Edit 1: I'm using Foundation framework

Answer

How about this if statement:

<% unless notice.nil? %>
   <p class="notice"><%= notice %></p>
<% end %>
<% unless alert.nil? %>
   <p class="alert"><%= alert %></p>
<% end %>