尝试为菜单项添加图像

时间:2013-08-17 06:12:41

标签: html jsf primefaces

这些是菜单项。请注意,我将图像类提供给City菜单项。

<p:submenu label="Address">
    <p:menuitem value="Country" url="/secured/country.xhtml?redirect=true" />
    <p:menuitem value="State" url="/secured/state.xhtml?redirect=true" />
    <p:menuitem value="City" url="/secured/city.xhtml?redirect=true" icon="images"/>                          
    <p:menuitem value="Location" url="/secured/location.xhtml?redirect=true" />
</p:submenu>

这是我的CSS课程:

 .images{
     background: url('../resources/images/admini.ico') no-repeat;
     height:16px;
     width:16px;
}

但是,不是出现图像,而是出现向上的箭头标记。我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

尝试将您的图标定义为以下

.ui-menuitem-icon.images{
     background: url('../resources/images/someImage.png') no-repeat;
     height:16px;
     width:16px;
}

并查看此帖子How do you add a custom icon to a menuitem?

答案 1 :(得分:0)

试试这个......

      .tabmenubutton
        {
         background:url("common/images/calendar.png") no-repeat !important;
         width:20px;
         height:20px;
        }

XHTML:

      <p:menuitem value="Country" icon="tabmenubutton"/>