[英]How to add background image and icon to a JSF button?
我正在使用JSF 2.0
我能夠將背景圖像添加到JSF按鈕,但不能將圖標添加到按鈕。
我的要求是:-帶有背景圖片和圖標的JSF按鈕
以下代碼用於添加背景。
<!-- Discard button-->
<h:commandButton action="discard" style="background-image: url('..\\Images\\leftMenuActiveBg.png');width: 150px;height: 30px;color: white;border-color: white;font-size: 15px; " value="#{message.discard}">
<rich:componentControl target="popup" operation="show" />
</h:commandButton>
有人也可以幫我在按鈕上添加圖標嗎?
我正在更新映像,以更好地解釋我想要實現的目標,以及我到目前為止通過以上代碼所實現的目標。
因此,您想要一個帶有兩個背景圖像的按鈕嗎? 在單個HTML元素上是不可能的。 <h:commandButton>
生成一個HTML <input type="submit">
元素,而您基本上需要一個<button type="submit" class="background"><span class="icon">
來代替。 您需要創建一個完全生成HTML的自定義組件,或者采用第三方組件librarty,該組件在其集合中具有此類組件,例如PrimeFaces 。 另請參見<p:commandButton>
展示櫃 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.