You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johannes Schneider <jo...@familieschneider.info> on 2007/09/01 11:22:27 UTC

Custom background image

Hi,

I want to add a custom background image for each page. This image should 
be configurable using Java code (random), so I can't use a style sheet.
Adding a section like

     <style type="text/css">
	//custom code here
     </style>

to the head could solve the problem. Could anybody point me to a small 
example showing how to achieve this?



Thanks,

Johannes Schneider

Re: Custom background image

Posted by Johannes Schneider <jo...@familieschneider.info>.
Thanks. That solves the problem.


Johannes Schneider

Matej Knopp wrote:
> Assuming you are using 1.3.
> 
> Make your page implement IHeaderContributor
> 
> class MyPage extends WebPage implements IHeaderContributor {
>    public void renderHead(final IHeaderResponse response) {
>        response.renderString("<style type=\"text/css\"> body {
> background-image: url("...") } </style>");
>    }
> }
> 
> Just beware that the background image URL must be either absolute, or is
> considered relative to the page URL.
> 
> -Matej
> 
> On 9/1/07, Johannes Schneider <jo...@familieschneider.info> wrote:
>> Hi,
>>
>> I want to add a custom background image for each page. This image should
>> be configurable using Java code (random), so I can't use a style sheet.
>> Adding a section like
>>
>>      <style type="text/css">
>>         //custom code here
>>      </style>
>>
>> to the head could solve the problem. Could anybody point me to a small
>> example showing how to achieve this?
>>
>>
>>
>> Thanks,
>>
>> Johannes Schneider
>>
>>
> 

-- 
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen

Fon +49 7072 9229972
Fax +49 7072 509999
Mobil +49 178 1364488

johannes@familieschneider.info
http://www.johannes-schneider.info

Re: Custom background image

Posted by Matej Knopp <ma...@gmail.com>.
Assuming you are using 1.3.

Make your page implement IHeaderContributor

class MyPage extends WebPage implements IHeaderContributor {
   public void renderHead(final IHeaderResponse response) {
       response.renderString("<style type=\"text/css\"> body {
background-image: url("...") } </style>");
   }
}

Just beware that the background image URL must be either absolute, or is
considered relative to the page URL.

-Matej

On 9/1/07, Johannes Schneider <jo...@familieschneider.info> wrote:
>
> Hi,
>
> I want to add a custom background image for each page. This image should
> be configurable using Java code (random), so I can't use a style sheet.
> Adding a section like
>
>      <style type="text/css">
>         //custom code here
>      </style>
>
> to the head could solve the problem. Could anybody point me to a small
> example showing how to achieve this?
>
>
>
> Thanks,
>
> Johannes Schneider
>
>