【发布时间】:2015-04-15 13:35:48
【问题描述】:
这是我的项目结构:
我要将css文件添加到HeaderTester.xhtml文件中:
这是HeaderTester.xhtml:
<?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">
<h:head>
<title>Here is header</title>
<link rel="stylesheet" type="text/css" href="headerStyle.css"/>
</h:head>
<h:body>
This is Header tester class
<div id="header">
<h3>Sajjad HTlo</h3>
</div>
</h:body>
</html>
CSS 文件:
*{
margin: 0;
padding: 0;
}
#header{
background-color: gray;
width: 100%;
height: 60px;
}
h1{
color: silver;
}
但只是在结果中显示文本!
【问题讨论】:
-
@Tiny 感谢您的链接,这是一个非常详细的解释