I am trying to vertically align icons on the navigation bar and I try to use this approach:
.element {
 position: relative;
 top: 50%;
 transform: translateY(-50%);
}
This is my code:
HTML
<div class="navbar">
  <nav>
    <ul>
      <% if logged_in? %>
        <li><%= link_to "IOAKA", dashboard_path %></li>
        <li><%= link_to(image_tag("icon_ioaka.png", alt: "geometry IOAKA icon", 
        :class => "icon", :id => "ioaka_icon2"), dashboard_path) %></li>
        <li><%= link_to(image_tag("icon_settings.png", alt: "geometry settings icon", 
        :class => "icon", :id => "settings_icon"), edit_user_path(current_user)) %></li>
        <li><%= link_to(image_tag("icon_logout.png", alt: "geometry logout icon", 
        :class => "icon", :id => "logout_icon"), logout_path, method: "delete") %></li>
      <% else %>
        <li><%= link_to "IOAKA", root_path %></li>
        <li><%= link_to(image_tag("icon_login.png", alt: "geometry login icon", 
        :class => "icon", :id => "login_icon"), login_path) %></li>
        <li><%= link_to(image_tag("icon_signup.png", alt: "geometry signup icon", 
        :class => "icon", :id => "signup_icon"), signup_path) %></li>
        <li><%= link_to(image_tag("icon_ioaka.png", alt: "geometry IOAKA icon", 
        :class => "icon", :id => "ioaka_icon1"), root_path) %></li>
      <% end %>
    </ul>
  </nav>
</div>
CSS
/*--------------------------------HEADER--------------------------------------*/
ul {
  list-style-type: none; /* Removes the bullets. A navigation bar does not need list markers */
  margin: 0; /* to remove browser default settings */
  padding: 0; /* to remove browser default settings */
  text-align: left; /* solves the behavior of center because of body tag text-align center */
}
li {
  display: inline; /* By default, <li> elements are block elements. Here, we remove the line breaks before and after each list item, to display them on one line */
}
a:link {
  text-decoration: none; /* unvisited link remove default undline */
}
a:active {
  color: black;  /* selected link remove default red color */
}
.icon {
  float: right; /* use float to get block elements to slide next to each other */
}
#ioaka_icon1 {
  height: 50px;
}
#signup_icon {
  height: 44px;
}
#login_icon {
  height: 50px;
}
.navbar {
  max-width: 100%;
  height: 65px;
  line-height: 65px; /* Aligns text vertically to the div the value has to be the same as the div! */
  background-color: white;
  border-bottom: #cfcfcf 3px solid;
}
If I use in this case:
.nav ul {
  position: relative;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}
It seems that the elements only are going 50% to the top (transform: translateY(-50%);) and the top: 50%; does not make any change?
Question: What am I missing and why is it not working? Thanks in advance!
 
     
     
    