Hi Tm,

Figuring out all the paths in wicket with added CSS and javascript always
seems to be a challenge.

For the HTML files in your "source" folders, "img src=" tags seem to
automatically adjusted to the context's root. The same goes for CSS links in
your <wicket:head>

Note that you can surround markup with <wicket:link>, which will cause the
paths of your link attributes in the markup to be adjusted.

Remember that url(...) attributes in CSS are always relative to the location
of the CSS file, which is actually handy, because once you link to the CSS
file, it doesn't matter what the path of the HTML is (like if you're viewing
the HTML vs deploying your app, it will change). For example if your CSS
file is:

/css/hello.css, and your image is in /images/smile.gif, then use
url(../images/smile.gif), and as long as you reference that CSS, the image
will always word.

Because of the edit HTML / deploy wicket app path changing problem, it's
often handy to stick with referencing files using their absolute path (with
the leading slash). Using page parameters in wicket will by default add
"paths" to the page. This tends to be an issue when adding static javascript
files. Links to files in javascript are always relative to the page's path
that's using the javascript (unlike CSS, where url() is relative to the CSS
file)

Sometimes it's handy to keep two CSS links in your header. One for HTML
editing, and one that works for deployment.

Hope this helps a bit!
-Sean

p.s. Sorry - last message got parsed strangely.
-- 
View this message in context: 
http://www.nabble.com/Apache-Tomcat---CSS-tp23503600p23505003.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to