Image_tag Positioning/Alignment

Hi:

I searched the forum before posting and could not find any help on how
to position an image using image_tag (‘image_name’).

I have an image in a div, and I need to move it to the right.

How do I this? I have this code:

<%= image_tag ('name.gif'), :options => {:align=>"right" } %>

I even tried this:

<%= image_tag ('name.gif') %>

and it does not seem to work.

Thanks in advance for taking the time to answer.

On Sun, Oct 25, 2009 at 11:49 AM, about2flip [email protected] wrote:

<%= image_tag ('name.gif'), :options => {:align=>"right" } %>

I even tried this:

<%= image_tag ('name.gif') %>

and it does not seem to work.

How would you do that on plain HTML? you should check your generated
HTML and compare it wth your plain HTML solution.
image_tag does nothing but generate an HTML tag with the
attributes you give as parameters. Check the rdoc for image_tag to see
what are those parameters.


Leonardo M…
There’s no place like ~

add to your css stylesheet:

#mainDivright { float: right; }

Just a little more elaboration…

I’m assuming your view contains:

<%= image_tag (‘name.gif’), id=“mainDivright” %>

If you check the html produced using firebug you should see something
like:

<img id=“mainDivright” src=…

The css stylesheet can key off this id.