如何使用PrimeFaces中的自定义图标? [英] How can I make use of customized icons in PrimeFaces?

查看:342
本文介绍了如何使用PrimeFaces中的自定义图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PrimeFaces提供了许多来自jQuery themeroller的图标.它们很有用,但我需要为我的应用程序提供一些自定义的图标.假设我有一个<p:commandButton>:

PrimeFaces provides a lot of icons from jQuery themeroller. They're useful but I need to have some customized icons for my app. Suppose I have a <p:commandButton>:

<p:commandButton icon="ui-icon ui-icon-check" />

由于我对CSS的了解非常有限,如果您能向我展示如何将一些自定义的图标放入上述按钮的标签中,我将不胜感激.

Since my CSS knowledge is very limited, I'd be very grateful if you could show me how I can put some customized icon into the label of the above button.

最诚挚的问候,

推荐答案

您需要定义自己的CSS类:

You need to define your own css class:

.img-button-help { background-image: url('../images/help.png') !important; }

,然后在您的p:commandButton中使用此类:

and then use this class in your p:commandButton:

<p:commandButton icon="img-button-help" />

这篇关于如何使用PrimeFaces中的自定义图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆