Re: CSS background images
Re: CSS background images
- Subject: Re: CSS background images
- From: "Denis Frolov" <email@hidden>
- Date: Wed, 13 Aug 2008 17:13:51 +0400
Hi,
On Wed, Aug 13, 2008 at 5:03 PM, A <email@hidden> wrote:
> Hey,
>
> I've been designing a layout with static html/css that I'm now trying
> to add dynamic elements to via webobjects. I added the stylesheet to
> WebServerResources/styles and the images to WebServerResources/images.
>
> In the stylesheet, I tried declarations like
> background-image: url('../images/img_00.gif');
> which should pull up the image for the directory structure I specified.
Relative urls in css should work - we use this approach for all our
projects. Open Activity window in Safari to debug the url to image
that doesn't work. You should see semething like:
http://localhost/cgi-bin/WebObjects/MyApp.woa/-41424/wr/wodata=/Users/user/Documents/workspace/MyApp/build/MyApp.woa/Contents/WebServerResources/images/logo.gif
Check this url in Finder to see why it fails.
>
> It didn't work, so I tried a few other relative urls, a few absolute
> urls, and never got the images to show.
>
> I decided I would use the WOResourceURL component to get at the
> images, so I created a WO component with declarations like:
> background-image: url('<wo name="Img00"/>');
>
> and the WOD file would say something like:
> Img00 : WOResourceURL { filename = "WebServerResources/Images/img_00.gif"; }
>
> I felt a little dirty doing this, since I would really rather have the
> stylesheet defined as a CSS file that the browser can easily cache
> rather than a WO component which bloats the generated mark up of every
> page in the app.
>
> There is an even bigger problem however, that each page now loads very
> slowly. It seems to me that all of the images are being reloaded on
> every request, which is making it painful to develop.
>
> So on to my questions:
>
> What is the best way to reference a stylesheet with images?
>
> If I use the approach I outlined, will the deployed app cache the CSS
> component and images so that they don't slow down the app?
>
> If so, is there something I can do in development to display the
> images but force them not to reload on every request?
>
>
> Thank you!
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden