-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi
For image component, instead of setting the src propery, can we assign the image via CSS
Senthilchettyin,
Yes, you can indeed set the image via CSS by using the background-image property. Here is an example:
<zk> <style> .myImageCSS { width: 25px; background-image: url("http://www.zkoss.org/zksandbox/img/defender.gif"); background-repeat: no-repeat; } </style> <window> <image sclass="myImageCSS"/> </window> </zk>
If memory serves, you do have to specify at least one dimension - height or width - to get it to appear correctly.
Hope that helps,
Todd
Hi Todd
It works perfectly.
Thank you very much, I tried the same way before your reply. Only thing is missed to put width property in the style.
Regards
Asked: 2012-05-02 10:22:20 +0800
Seen: 146 times
Last updated: May 03 '12