You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by deian <de...@gmail.com> on 2009/10/07 15:49:16 UTC

background: url(${context: image}) in CSS file?

Hi Guys,

What can we do about using tapestry variables in the CSS files?

I have a css file in where I want to use an image as background. So I want
to use something along the lines: 

mySite.css 

.mystyle {
  background: url(${context:images/myImage.png});
}

Any ideas?

Cheers,
Deian
-- 
View this message in context: http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25786987.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: background: url(${context: image}) in CSS file?

Posted by Daniel Jones <da...@murieston.com>.
Use a relative path.

In my applications I store my CSS in:
src/main/webapp/assets/styles/
And my images in:
src/main/webapp/assets/images/

An example of using a relative path in my CSS file:
background-image: url('../images/logo.png');

The path is relative to the CSS file and NOT the page, so this should work
fine on all pages.

Hope this helps,
Daniel



deian wrote:
> 
> Hi Guys,
> 
> What can we do about using tapestry variables in the CSS files?
> 
> I have a css file in where I want to use an image as background. So I want
> to use something along the lines: 
> 
> mySite.css 
> 
> .mystyle {
>   background: url(${context:images/myImage.png});
> }
> 
> Any ideas?
> 
> Cheers,
> Deian
> 

-- 
View this message in context: http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25802983.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: background: url(${context: image}) in CSS file?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 07 Oct 2009 10:49:16 -0300, deian <de...@gmail.com>  
escreveu:

> Hi Guys,

Hi!

> What can we do about using tapestry variables in the CSS files?

You could create a page class that returns CSS, but I haven't used this  
approach. I add a <style> tag to my layout component and then write all my  
Tapestry-dependent CSS there.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: background: url(${context: image}) in CSS file?

Posted by cordenier christophe <ch...@gmail.com>.
Hello

Why not using relative paths ?

Christophe.

2009/10/7 deian <de...@gmail.com>

>
> Hi Guys,
>
> What can we do about using tapestry variables in the CSS files?
>
> I have a css file in where I want to use an image as background. So I want
> to use something along the lines:
>
> mySite.css
>
> .mystyle {
>  background: url(${context:images/myImage.png});
> }
>
> Any ideas?
>
> Cheers,
> Deian
> --
> View this message in context:
> http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25786987.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>