简体   繁体   English

PrimeFaces自定义菜单图标未呈现

[英]PrimeFaces custom menu icon not rendered

I'm on a process of developing a JSF application which uses PrimeFaces component library as well. 我正在开发一个也使用PrimeFaces组件库的JSF应用程序。 I wanted to apply some menubar component in my application; 我想在应用程序中应用一些菜单栏组件。 however, the icon that I created couldn't get rendered. 但是,无法创建我创建的图标。 In PrimeFaces documentation, it is stated that for custom icon I should have a css class. 在PrimeFaces文档中,声明对于自定义图标,我应该具有一个CSS类。 I created the css with an image and feed it to the menubar icon attribute but it didn't work. 我用图像创建了CSS,并将其输入到菜单栏的icon属性,但是没有用。 The following is my css. 以下是我的CSS。

.mainPageIcon {
    background: url(/images/motorStop.png) no-repeat;
    height: 16px;
    width: 16px;
}

<p:menubar>
     <p:menuitem icon="mainPageIcon" value="mainPage"/>
</p:menubar>

What should I do for the matter? 我该怎么办?

In Primefaces, to use a CSS class, you use the attribute styleClass. 在Primefaces中,要使用CSS类,请使用属性styleClass。 It is equivalent to class in Html. 它等效于HTML中的class。 So, 所以,

 <p:menuitem styleClass="mainPageIcon" value="mainPage"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM