日期:2014-05-17  浏览次数:20652 次

我在用CSS编一个表格,想把背景图片加到表头里,而表单的背景是空白的,具体代码和相关信息如下。在线等!
<style type="text/css">
<!--
body,table{
  font-size:12px;
}
 
table{
  table-layout:fixed;
  empty-cells:show; 
  border-collapse: collapse;
  margin:0 auto;
}
td{
  height:20px;
}
h1,h2,h3{
  font-size:12px;
  margin:0;
  padding:0;
}
.title { background: #FFF; border: 1px solid #9DB3C5; padding: 1px; width:90%;margin:20px auto; }
  .title h1 { line-height: 31px; text-align:center; background: #2F589C url(th_bg2.gif); background-repeat: repeat-x; background-position: 0 0; color: #FFF; }
  .title th, .title td { border: 1px solid #CAD9EA; padding: 5px; }
 
 
 
table.t1{
  font-family: sans-serif;
  border:1px solid #cad9ea;
  color:#696969;
}
table.t1 th {
  background-image: url(th_bg9.gif);
  background-repeat::repeat-x;
  height:30px;
}
table.t1 td,table.t1 th{
  border:1px solid #cad9ea;
  padding:0 1em 0;
}
table.t1 tr.a1{
  background-color:#DCDCDC;
}
-->
</style>
 
  <table width="80%" id="mytab" border="0" class="t1">
 <style nav>
  .nav
  {
  background-image:url("images/home.jpg") no-repeat;
  }
  </style>
  <tr class="nav">
  <td class="nav">1111</td>
  <th>1111</th>
  <th>1111</th>
  <th>1111</th>
  </tr>
  </table>
这个NAV的例子我是在网上找到的,用了之后完全没效果,请各位大神帮忙!

------解决方案--------------------
<style nav>
.nav
{
background-image:url("images/home.jpg") no-repeat;
}
</style>

放到表格外面去,

然后改成
.nav
{
background:url("images/home.jpg") no-repeat;
}

background-image是不能写 no-repeat的background才可以