adding a menuitem with image on Menubar

asked 2013-03-14 12:21:18 +0800

nsharma gravatar image nsharma flag of India
917 1 11

updated 2013-03-15 02:34:23 +0800

vincentjian gravatar image vincentjian
2245 6

Trying to add menuitem with image and having no label in it.

            <menuitem image="/test/image.gif" onClick="@command('doSomething')"/>
            <menuitem />

if i add a image without any label it cuts the image from both sides(right and bottom) ,and if i use some text in label the full image is shown ,

my problem is i have to show a menuitem with only image on it and no text. I can't change the size of image.

The following code works but i don't want to add label

            <menuitem label="a" image="/test/image.gif" onClick="@command('doSomething')"/>
            <menuitem />

does anybody know how to do it?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-15 02:29:38 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2013-03-19 04:06:48 +0800

Specify custom-attributes org.zkoss.zul.image.preload to make sure the image is loaded then render the menu item.

    <custom-attributes org.zkoss.zul.image.preload="true" />
    <meunitem image="/test/image.gif" />


The image is added as an background-image of HTML element. Therefore, you have to override the style and assign the size of the image to the correspond HTML element.

    .z-menuitem-btn {
        width: 16px !important;
        height: 16px;
link publish delete flag offensive edit


it's not working.

hswain ( 2013-03-15 05:31:36 +0800 )edit

Yes,i too tried it,but not working.

nsharma ( 2013-03-15 05:43:13 +0800 )edit

I verify the issue again, please check the edit part.

vincentjian ( 2013-03-19 04:02:09 +0800 )edit

actaully here i am having more than one menuitem in here,so it is overriding the other item,still not working,i think i need to put style on one particular item .

nsharma ( 2013-03-20 09:31:07 +0800 )edit

Thanks for your help.

nsharma ( 2013-03-20 09:37:44 +0800 )edit
Your answer
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

1 follower



Asked: 2013-03-14 12:21:18 +0800

Seen: 141 times

Last updated: Mar 19 '13

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