Mystic Chimp
Mystic Chimp

Reputation: 115

Rails erb styling CSS

I wonder if anyone can help with this... Below is the code for a short list on a users profile page. I want to be able to style the fixed text ie 'Name', 'Email' and 'User Type' with h2 and the ruby provided content with say h4. My problem is that when I use something like the code on line 6 and embed the h4 content between tags. The text jumps out of sequence and appears on another line. What would be the correct way to organise this so that I can style the ruby with the different tags and keep the text in line.

Many Thanks

1<div class="profile-content">
2   <ul>
3       <li><h2>Name: <%= @user.name %></h2></li>
4       <li><h2>Email: <%= @user.email %></h2></li>
5       <% if @user.admin %>
6       <li><h2>User Type: <h4>Admin</h4> </h2></li>
7       <% else %>
8       <li><h2>User Type: Standard</h2></li>
9       <% end %>
10  </ul>
11</div>

Upvotes: 0

Views: 388

Answers (2)

Timmy Von Heiss
Timmy Von Heiss

Reputation: 2218

<li><h2>User Type:</h2> <h4>Admin</h4> </li>

h2, h4 { display: inline-block } 

You can also use as a spacer between lines:

What is a clearfix?

Upvotes: 1

Jem
Jem

Reputation: 656

You should close your h2 tag before starting your h4 tag.

<li><h2>User Type: </h2><h4>Admin</h4> </li>

Upvotes: 0

Related Questions