1

how do i link my Logo which is made out of Text and CSS to my root_path and the inside of it?

This is how it would look without Rails:

<h1><a href=#>Main Title<span>subtitle</span></a></h1>

I am using no images and just plain CSS text for the Logo.

Thank you!

LearningRoR
  • 26,582
  • 22
  • 85
  • 150

1 Answers1

1

If you mean link to root page:

<h1><%= link_to 'Main Title<span>subtitle</span>'.html_safe, '/' %></h1>

If you want other locations and have some resources set up, you could use paths:

<h1><%= link_to 'Main Title<span>subtitle</span>'.html_safe, example_path %></h1>


If you happen to need even more HTML markup in the link, then check this question out:

Community
  • 1
  • 1
Karol J. Piczak
  • 585
  • 1
  • 5
  • 24
  • 1
    Normally strings are HTML escaped. If you want to stuff some arbitrary HTML tags in there as in this case, you have to designate the string as *safe*, so that it's printed out explicitly. This was introduced some time ago as a way to help circumvent XSS attacks. More on here: http://weblog.rubyonrails.org/2009/10/12/what-s-new-in-edge-rails – Karol J. Piczak May 01 '11 at 20:47
  • hmm i am using a mixture of html and ruby code so its very helpful to point out the .HTML_SAFE tag, ill do some more research on this. Thank you! – LearningRoR May 01 '11 at 21:10