Problem with CSS in JSF & Primefaces

0

Project - JSF CDI Mysql // I'm not using Maven

Good afternoon guys, my question is this: I would rather than use style="....."; in xhtml code, to make code more elegant, make use of css.

For example, I want instead of:

<p:fieldset style="background-color: #9ECADE;">

Make use of a class in css to then assign the style. I then created a directory in WebContent - resources - css - style.css inside the css so I made a small edit:

.barra-navegacao{
    background-color: #9ECADE;
}

and within my template, I look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
    <link href="https://fonts.googleapis.com/css?family=Righteous"
        rel="stylesheet" />
    <h:outputStylesheet library="css" name="style2.css" />
</h:head>
<h:body>
    <div id="cabecalho" align="center">
        <p:graphicImage library="img" name="logo01.png" />
        <h1 align="center">
            <p:fieldset>
                <ui:insert name="titulo" />
            </p:fieldset>
        </h1>

    </div>

    <div>

        <ui:insert name="conteudo" />

    </div>
</h:body>
</html>

However, the problem is that editing does not work, and when it works, it's like saving the css somewhere, and when I edit, it does not update the edit in css. Could someone help me pfvr ??

Incidentally, I would like to know how to change a component of Primefaces, for example: color, size and etc by css classes. I have downloaded doc, and researching it, but it's difficult to kk ''

    
asked by anonymous 31.08.2017 / 23:37

1 answer

1

Come on, you can use css classes yes, instead of using style , use styleClass . Ex:

styleClass="barra-navegacao"

To change a component's css, see in the documentation which will shut down and overwrite it.

link

    
31.08.2017 / 23:51