Forum: Ruby on Rails link_to CSS problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
zavulon (Guest)
on 2006-05-24 05:03
Hi all,

I'm a Ruby/Rails/web development newbie, so this may be a stupid
question. I'm putting some links using link_to into my rhtml page,
creating the layout using the DIV tag:

<div id="description">
   <%= link_to h (item.description), :action => 'show', :id => item.id
%>
</div>

...

div#description {
  float: left;
  width: 75%;
  height: 20%;
}

If I put regular text in there instead of a link_to, then the text
appears right next to the border of the div, which is what I want. But
if I put a link_to in there, it has a huge margin that I don't
understand where it's coming from.

Another (related) issue that I have, is that if I have two link_to's in
there, they appear on separate lines. Is there a way to put have them on
the same line?

Thanks a lot!
Ezra Z. (Guest)
on 2006-05-24 06:43
(Received via mailing list)
On May 23, 2006, at 6:03 PM, zavulon wrote:

>
> if I put a link_to in there, it has a huge margin that I don't
> understand where it's coming from.
>
> Another (related) issue that I have, is that if I have two
> link_to's in
> there, they appear on separate lines. Is there a way to put have
> them on
> the same line?
>
> Thanks a lot!
>

Hey Zavulon-

	The standard <%= %>  tags will always put a newline "\n" in the
stream of text they get evaluated into. In order to not emit a
newline use tags like this:  <%=  -%>  the -  tells erb not to put a
newline there.


Cheers-
-Ezra
This topic is locked and can not be replied to.