When I put my style css in the same xhtml page, it's work with me page, like :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<style>
.ui-dialog-titlebar{
color:red;
}
.ui-dialog-title{
background-color: green;
}
</style>
</h:head>
<h:body>
<p:panelGrid style="border:hidden" >
<h:form>
<p:row>
<p:column style="font-weight: bold;border:hidden;">
<p:commandLink id="ajax" update="growl" actionListener="#{dfView.showMessage}" onclick="PF('dlg1').show();">
<h:outputText value="Log in" />
</p:commandLink>
</p:column>
</p:row>
</h:form>
</p:panelGrid>
<p:dialog header="Log in" widgetVar="dlg1" modal="true" height="300" dynamic="true">
</p:dialog>
<div class="index_center_text">
</div>
</h:body>
</html>
in this cas I can style my dialog header. But I need to put all my css in a separate file and load only its url.
I tried to do something like :
1-
<h:body>
<h:outputStylesheet name="/resources/css/style.css" />
...
</h:body>
2-
<h:body>
<h:outputStylesheet name="/css/style.css" />
...
</h:body>
3-
<h:head>
<f:facet name="last">
<h:outputStylesheet name="/resources/css/style.css" />
</f:facet>
</h:head>
4-
<h:head>
<link rel="stylesheet" media="screen" href="resources/css/style.css" type="text/css" />
</h:head>
5-
<h:head>
<link rel="stylesheet" media="screen" href="css/style.css" type="text/css" />
</h:head>
And style.css :
.ui-dialog-titlebar{
color:red;
}
.ui-dialog-title{
background-color: green;
}
.index_center_text{
height:200px;
width:100%;
background-color:#E9F3FF
}
but all these don't work with me .
Folder structure
WebContent
|-- META-INF
|-- resources
| |-- css
| | `-- style.css
| `-- images
| |-- logo.png
|-- WEB-INF
| |-- bib
| |-- faces-config.xml
| |-- web.xml
|
|-- index.xhtml
please anybody can help me !
Edited :
Thank you so much @BalusC I did what you told me. I found these:
1- when I use <h:outputStylesheet name="/css/style.css" />
,
the response while requesting style.css file like :
@CHARSET "ISO-8859-1";
.ui-box{
border-color: red;
}
.overlayDialog div.ui-dialog-titlebar{
background-color: green;
}
(there is no index_center_text class)
2- when I use this <h:outputStylesheet name="/resources/css/style.css" />
, it didn't reach to my css file (no response)
3- when I use <h:outputStylesheet library="css" name="style.css" />
, the response while requesting style.css file like :
@CHARSET "ISO-8859-1";
.ui-dialog-titlebar{
color:red;
}
.ui-dialog-title{
background-color: green;
}
.index_center_text{
height:200px;
width:100%;
background-color:#E9F3FF
}
but the problem it doesn't style my div :
<div class="index_center_text">
</div>
Note :
I remark that when I change my css it doesn't really change it because when I check my request using firebug for example. it takes into consideration the old css still there ... Amazing Although I clean and build many times my project , the problem still here.