Link_to CSS problem


#1

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:

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

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!


#2

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