0

ZK Image Component

asked 2012-05-02 10:22:20 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

Hi

For image component, instead of setting the src propery, can we assign the image via CSS

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-05-02 16:16:19 +0800

twiegand gravatar image twiegand
1807 3

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

link publish delete flag offensive edit

answered 2012-05-03 13:06:20 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-05-02 10:22:20 +0800

Seen: 146 times

Last updated: May 03 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More