我正在使用primefaces我想把我所有的css放在一个单独的文件css中。当我把我的风格放到同一页面xhtml中时,它与我一起工作,如:
<h:body>
<div style="height:200px;width:100%;background-color:#E9F3FF">
</div>
</h:body>
但是当我把我的CSS放在一个单独的文件中时,它并没有和我一起工作,比如
<h:body>
<h:outputStylesheet library="css" name="style.css" />
<div class="index_center_text">
</div>
</h:body>
或
<h:head>
<h:link rel="stylesheet" type="text/css" href="/resources/css/style.css" />
<h:body>
<div class="index_center_text">
</div>
</h:body>
style.css:
.index_center_text {
height:200px;
width:100%;
background-color:#E9F3FF
}
文件夹结构
WebContent
|-- META-INF
|-- resources
| |-- css
| | `-- style.css
| `-- images
| |-- logo.png
|-- WEB-INF
| |-- lib
| |-- faces-config.xml
| |-- web.xml
|
|-- index.xhtml
请任何人都可以帮助我!
答案 0 :(得分:-1)
这应该适合你。
<h:head>
<link rel="stylesheet" type="text/css" href="resources/css/style.css"/>
</h:head>