Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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 表链接在Firefox、IE8中不起作用_Html_Css_Html Table_Href - Fatal编程技术网

Html 表链接在Firefox、IE8中不起作用

Html 表链接在Firefox、IE8中不起作用,html,css,html-table,href,Html,Css,Html Table,Href,我有一张有背景图像(精灵)的桌子。表格的td用作相对于精灵图像位置的链接。我是这样的: CSS: HTML: 它可以在Chrome中使用(链接可以点击),但不能在Firefox和IE8中使用。奇怪的是,如果我将td a从百分比更改为像素,它似乎可以工作,但这会破坏我的精灵位置…那么我该怎么做才能使链接工作?您必须指定父元素(td)的宽度和高度,以便将%用于子项 table.populair { background-image:url(populair.png); backg

我有一张有背景图像(精灵)的桌子。表格的td用作相对于精灵图像位置的链接。我是这样的:

CSS:

HTML:



它可以在Chrome中使用(链接可以点击),但不能在Firefox和IE8中使用。奇怪的是,如果我将td a从百分比更改为像素,它似乎可以工作,但这会破坏我的精灵位置…那么我该怎么做才能使链接工作?

您必须指定父元素(td)的宽度和高度,以便将%用于子项

table.populair {
    background-image:url(populair.png);
    background-position:27px 27px;
    background-repeat:no-repeat;
}


table tr td {
    border:solid 1px #ccc;
    border-radius:4px;
    display:table-cell;
    width: 10%;
    height: 100%;
}

table tr td a{
    display:block;
    width: 100%;
    height: 100%;
    margin-left: -3px;
    margin-top: -2px;
    z-index:15;
}​

<table class="populair" border="0" bordercolor="#FFCC00" width="647" height="322" cellpadding="0" cellspacing="27">
            <tr>
                <td><a href="http://www.link.com/"></a>
                </td>
                <td><a href="http://www.link.com/"></a>
                </td>
                <td><a href="http://www.link.com/"></a>
                </td>
                <td><a href="http://www.link.com/"></a>
                </td>
                <td class="none">
                </td>
            </tr>
            </table>
table.populair {
    background-image:url(populair.png);
    background-position:27px 27px;
    background-repeat:no-repeat;
}


table tr td {
    border:solid 1px #ccc;
    border-radius:4px;
    display:table-cell;
    width: 10%;
    height: 100%;
}

table tr td a{
    display:block;
    width: 100%;
    height: 100%;
    margin-left: -3px;
    margin-top: -2px;
    z-index:15;
}​