h1, h2, h3, h4, h5, h6 {
  margin: 1em 1em 1em 1em;
  padding:1em 1em 1em 1em;
  color:#ff00ff;
  border: thin dotted green; 
  text-align:center;
}
body {
  text-align:center;
  font: normal small-caps 600 12pts/150% Courier; 
  color: green; 
  background: url("../image/backdround.jpg");
}a {
  color:red;
}
<%@ page contentType="text/html;charset=gb2312"%><html>
<head>
<title>JSP测试</title>
                <style type="text/css">
<!--
@import url(css/styles.css);
-->
</style>
</head>
<body>
<h3>测试首页</h3>
<a href ="Date.jsp">时间测试</a>
</body>
</html>

解决方案 »

  1.   

    没显示背景图片一般有两原因,一是背景图片的相对路径不对,二是有背景颜色!
    还有啊!你这个直接放到jsp里还是用css样式文件引用啊?一定要注意相对路径哦!
      

  2.   

    <%@ page contentType="text/html;charset=gb2312"%>这个应该放在开头
      

  3.   

    background: url("../image/backdround.jpg");
    看看路径对不对
      

  4.   

    是不是我看错了?   前面的CSS内容是在  css/styles.css  这个文件里是吧
      

  5.   

    作为调试,把css/styles.css里的内容直接嵌入到JSP里,把 background: url("../image/backdround.jpg"); 改下路径(是 background: url("image/backdround.jpg");吧),看看
      

  6.   

    <body style="background:fixed url('<%=request.getContextPath()%>/images/page/tu2.gif') center center no-repeat" >
    一个加载 图片的例子,(要根据你的目录把图片加上即可);
    多数还是目录不正确的问题