Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为什么不显示表格背景?_Html_Css_Html Table - Fatal编程技术网

Html 为什么不显示表格背景?

Html 为什么不显示表格背景?,html,css,html-table,Html,Css,Html Table,我有一个表,我试图应用背景图像,但它没有显示。图像路径正确(firebug表示图像已加载),表大小与图像大小相同(156X46px) HTML: 首先,背景位置必须是像素或“中心”等 这“可能”解决了这个问题 table.hazard-table { background:url('../images/icon-item.png') no-repeat; width:156px; height:46px; border-width: 1px; border

我有一个表,我试图应用背景图像,但它没有显示。图像路径正确(firebug表示图像已加载),表大小与图像大小相同(156X46px)

HTML:

首先,背景位置必须是像素或“中心”等

这“可能”解决了这个问题

table.hazard-table {
    background:url('../images/icon-item.png') no-repeat;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;
    background-color: white;
}
首先,背景位置必须是像素或“中心”等

这“可能”解决了这个问题

table.hazard-table {
    background:url('../images/icon-item.png') no-repeat;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;
    background-color: white;
}
这:

background-color: white;
用白色背景覆盖图像。 你应该改为:

  table.hazard-table {
        background:white url('../images/icon-item.png') no-repeat;
        width:156px;
        height:46px;
        border-width: 1px;
        border-spacing: 2px;
        border-style: solid;
        border-color:#ebebeb;
        border-collapse: collapse;
}
编辑:

试试这个:

  table{
.hazard-table {
    background:white url("../images/icon-item.png") no-repeat;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;


    th{
        border-width: 1px;
        padding: 1px;
        border-style: inset;
        border-color: #ebebeb;
        background-color: white;
        -moz-border-radius: ;
        } 

        td{
           background-position:30 20 ;
           border-width: 1px;
           padding: 1px;
           border-style: inset;
           border-color: #ebebeb;
           background-color: white;
           -moz-border-radius: ;
       }
}
这:

background-color: white;
用白色背景覆盖图像。 你应该改为:

  table.hazard-table {
        background:white url('../images/icon-item.png') no-repeat;
        width:156px;
        height:46px;
        border-width: 1px;
        border-spacing: 2px;
        border-style: solid;
        border-color:#ebebeb;
        border-collapse: collapse;
}
编辑:

试试这个:

  table{
.hazard-table {
    background:white url("../images/icon-item.png") no-repeat;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;


    th{
        border-width: 1px;
        padding: 1px;
        border-style: inset;
        border-color: #ebebeb;
        background-color: white;
        -moz-border-radius: ;
        } 

        td{
           background-position:30 20 ;
           border-width: 1px;
           padding: 1px;
           border-style: inset;
           border-color: #ebebeb;
           background-color: white;
           -moz-border-radius: ;
       }
}
希望此链接对您有用

  table.hazard-table {
   /* background:url('../images/icon-item.png') no-repeat 0 0;*/
    background:url('http://img.talkandroid.com/uploads/2013/03/wpid-photo-jan-14-2013-1115-am.jpg') no-repeat 0 -550px;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;
    /* background-color: white;*/
}
table.hazard-table th {
    border-width: 1px;
    padding: 1px;
    border-style: inset;
    border-color: #ebebeb;
    background-color: white;
    -moz-border-radius: ;
}
table.hazard-table td {
    background-position:30 20 ;
    border-width: 1px;
    padding: 1px;
    border-style: inset;
    border-color: #ebebeb;
   /* background-color: white;*/
    -moz-border-radius: ;
}
希望此链接对您有用

  table.hazard-table {
   /* background:url('../images/icon-item.png') no-repeat 0 0;*/
    background:url('http://img.talkandroid.com/uploads/2013/03/wpid-photo-jan-14-2013-1115-am.jpg') no-repeat 0 -550px;
    width:156px;
    height:46px;
    border-width: 1px;
    border-spacing: 2px;
    border-style: solid;
    border-color:#ebebeb;
    border-collapse: collapse;
    /* background-color: white;*/
}
table.hazard-table th {
    border-width: 1px;
    padding: 1px;
    border-style: inset;
    border-color: #ebebeb;
    background-color: white;
    -moz-border-radius: ;
}
table.hazard-table td {
    background-position:30 20 ;
    border-width: 1px;
    padding: 1px;
    border-style: inset;
    border-color: #ebebeb;
   /* background-color: white;*/
    -moz-border-radius: ;
}

呜呜声。我完全错过了背景色:白色;干得好:)试试[
code
]背景图像:url('../images/icon item.png');背景重复:无重复;背景色:#fff;[
code
]哦,很抱歉它能用!谢谢!忘了我也用了背景色。我完全错过了背景色:白色;干得好:)试试[
code
]背景图像:url('../images/icon item.png');背景重复:无重复;背景色:#fff;[
code
]哦,很抱歉它能用!谢谢!忘了我也用了背景色。