Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add an image or icon to primefaces tab header

im trying to use an image /icon on a tab header instead of text title(or may using both of them), i was testing using titleStyleClass seting an image background but doesnt work

my primefaces tab:

 <p:tab titleStyleClass="tCliente" title="Vehiculo">

My css style

 .tCliente 

 {     
   background-image: url(../images/logo_tropidatos.gif);
 }

Thanks for your help :D

like image 615
arkantos Avatar asked Jan 23 '12 19:01

arkantos


3 Answers

On PrimeFaces 3.0 and newer you can add a facet to override title on tabs:

<p:tabView>
    <p:tab>
        <!-- overrides title on tab-->
        <f:facet name="title">
               <h:outputText value="tab title"/>
               <p:graphicImage value="/resources/images/icon.png"/>
            </f:facet>

        <h:panelGrid>
            <!-- tab content -->
        </h:panelGrid>
    </p:tab>    
</p:tabView>

Hope it helps.

like image 100
sabadow Avatar answered Nov 15 '22 23:11

sabadow


try adding display:inline-block;

like image 36
Daniel Avatar answered Nov 16 '22 00:11

Daniel


You should put:

background-image: url("../images/logo_tropidatos.gif") !important;

but after that i have a problem: the image repeat into the header. I tried to solve adding background-repeat:no-repeat; but is the same... can someone help?

like image 1
Ricardo Avatar answered Nov 15 '22 23:11

Ricardo