开发者

How to write code for non-image Logo in Ruby on Rails

how do i write a Logo thats made out of pure css so its just like how i would write it in its html form, how does it look in Ruby/Ruby on Rails?

Right now i have this:

<div id="logo">
<h1><%= link_to 'Title <span>title</span>'.html_safe, root_path %></h1>
</div>

I am new to Ruby and Rails so i have no idea how to include the < span > and i don't think i should be playing with th开发者_JAVA百科e .Html_safe either.


In cases like this, I prefer to have more control over the HTML, since including HTML as a string to a helper method is just nasty.

<div id="logo">
  <h1>
    <a href="<%= root_path %>">
      Title <span>title</span>
    </a>
  </h1>
</div>

The helpers like link_to are helpful, but when they make you jump through hoops they aren't worth using.


<div id="logo">
  <h1><%= link_to raw('Title <span>title</span>'), root_path %></h1>
</div>


You can use link_to with a block:

<%= link_to root_path do %>
  Title <span>title</span>
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜