Home >Web Front-end >HTML Tutorial >I am using CSS to compile a table and want to add a background image to the table header, but the background of the form is blank. The specific code and related information are as follows. Waiting online! _html/css_WEB-ITnose

I am using CSS to compile a table and want to add a background image to the table header, but the background of the form is blank. The specific code and related information are as follows. Waiting online! _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:261851browse

ef0d2420b1e5291570a81009eee48a1a
1c45858e5b3042740ffa2ba2741d26a3
531ac245ce3e4fe3d50054a55f265927
 
  7cc7f41e199b89fd8161874720f2584c
 dbf71b1d6e6c977e8a4af7b1b9e2f145
    .nav
    {
        background-image:url("images/home.jpg") no-repeat;
    }
    531ac245ce3e4fe3d50054a55f265927
    1933447633303103646cceb98df5d250
      a1dfe6b8d761fe7f68f843e1d13b64f91111b90dd5946f0946207856a8a37f441edf
      b4d429308760b6c2d20d6300079ed38e111101c3ce868d2b3d9bce8da5c1b7e41e5b
      b4d429308760b6c2d20d6300079ed38e111101c3ce868d2b3d9bce8da5c1b7e41e5b
      b4d429308760b6c2d20d6300079ed38e111101c3ce868d2b3d9bce8da5c1b7e41e5b
    fd273fcf5bcad3dfdad3c41bd81ad3e5
    f16b1740fad44fb09bfe928bcc527e08
这个NAV的例子我是在网上找到的,用了之后完全没效果,请各位大神帮忙!


回复讨论(解决方案)

dbf71b1d6e6c977e8a4af7b1b9e2f145
  .nav
  {
  background-image:url("images/home.jpg") no-repeat;
  }
  531ac245ce3e4fe3d50054a55f265927

放到表格外面去,

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

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

老大 我放到表格外边了 可还是没效果 是不是我放错位置了?  你告诉一下我具体放到哪儿吧 谢谢了 dbf71b1d6e6c977e8a4af7b1b9e2f145
  .nav
  {
  background-image:url("images/home.jpg") no-repeat;
  }
  531ac245ce3e4fe3d50054a55f265927

放到表格外面去,

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

background-image是不能写 no……

例子

<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 {  height:30px;}table.t1 td,table.t1 th{  border:1px solid #cad9ea;  padding:0 1em 0;}table.t1 tr.a1{  background-color:#DCDCDC;}  .nav  {  background:url("http://www.fjms.net/pic/vImage/2008-08/20080806122054907875.jpg") no-repeat;  }</style>   <table width="80%" id="mytab" border="0" class="t1">  <tr class="nav">  <td class="nav">1111</td>  <th>1111</th>  <th>1111</th>  <th>1111</th>  </tr>  </table>

I solved it, but nav still doesn’t work. I added the background image to the table and it worked. . . Example

HTML code
080b747a20f9163200dd0a7d304ba388
body,table{
font-size:12px;
}

table{
table-layout:fixed;
empty-cells:show;
border-collapse: collapse;
margin:0 auto;
}
td{
height :20……

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Next article: