动态 Web 项目 Eclipse 的 XHTML 文件中的 CSS 方式和位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11325461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How and where CSS in XHTML file of Dynamic Web Project Eclipse
提问by user1494328
I'm trying to link css file to xhtml page in several ways but nothing what I did want to work. Here is folders structure of project:
我正在尝试以多种方式将 css 文件链接到 xhtml 页面,但没有任何我想做的工作。这是项目的文件夹结构:
Project
Java serources
WebContent
**index.xhtml**
META-INF
WEB-INF
style
**style.css**
Now in index.xhtml file I have:
<link rel="stylesheet" href="style/style.css" />
现在在 index.xhtml 文件中我有:
<link rel="stylesheet" href="style/style.css" />
Can someone tell me what I do wrong?
有人能告诉我我做错了什么吗?
回答by Daniel
Add resources
folder under the WebContent
resources
在下面添加文件夹WebContent
and inside resources
create css
folder
并在resources
创建css
文件夹内
then access the files like this
然后像这样访问文件
<h:outputStylesheet library="css" name="myNewStylesFile.css" target="head" />
Here's a tutorial Resources (library) in JSF 2.0
回答by dsfg
Put your link tag as I mention below:
把你的链接标签放在我下面提到的:
<link href="style/style.css" rel="stylesheet" type="text/css"/>