Forum: Ruby on Rails Rails erb in inline CSS(in layout file)

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.
Srinath A. (Guest)
on 2009-02-18 17:17
Hi,
How can we call rails erb tag in inline CSS
app/layouts/base_layout.rhtml:

        <body>
    <style>
        #header {
            background:
url(http://www.google.ca/intl/en_in/images/logo.gif) no-repeat;
            }
    </style>
    <div id="header"></div>
        </body>


I want to replace url(http://www.google.ca/intl/en_ca/images/logo.gif)
with
<%= image_tag(@customer_logo.path_to_logo_image, :width => 250, :height
=> 100) %> with out keeping #header in .css file


any help

thanks !!
Phlip (Guest)
on 2009-02-18 17:25
(Received via mailing list)
Srinath A. wrote:

> I want to replace url(http://www.google.ca/intl/en_ca/images/logo.gif)
> with
> <%= image_tag(@customer_logo.path_to_logo_image, :width => 250, :height
> => 100) %> with out keeping #header in .css file

image_path() ?
Jeff E. (Guest)
on 2009-02-18 17:26
(Received via mailing list)
Exactly as you described should work.

On Feb 18, 10:17 am, "Srinath A." <removed_email_address@domain.invalid>
Srinath A. (Guest)
on 2009-02-18 17:30
Hi,
but i code like this :

<style>
        #header {
            background:
url(<%= image_tag(@customer_logo.path_to_logo_image, :width => 250,
:height => 100) %>) no-repeat;
            }
    </style>

this is producing error...


Jeff Emminger wrote:
> Exactly as you described should work.
>
> On Feb 18, 10:17�am, "Srinath A." <removed_email_address@domain.invalid>
Jeff E. (Guest)
on 2009-02-19 00:13
(Received via mailing list)
I don't think you want to put an image tag there, probably just
something like this instead:


<style>
        #header {
            background: url(<%= @customer_logo.path_to_logo_image %>)
no-repeat;
        }
</style>


On Feb 18, 10:30 am, "Srinath A." <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.