道明不会成为链接?

时间:2015-08-26 02:17:15

标签: html css html-table

我搜索了所有主题但没有工作! 我试图完全覆盖标签,但它不会在TD的任何地方输入任何链接,甚至文本都没有!

HTML

        <table border=1>
            <tr>
                <a href="1.php"><td>A</td></a>
                <a href="2.php"><td>B</td></a>
                <a href="3.php"><td>C</td></a>
            </tr>
            <tr>
                <a href="4.php"><td>D</td></a>
                <a href="5.php"><td>E</td></a>
                <a href="6.php"><td>F</td></a>
            </tr>
        </table>

CSS

            table {
            border-collapse:collapse;
            border:white;
            background-color:#0078ff;
        }

        td {
            font-size:50px;
            padding:50px;
            text-align:center;
            color:white;
        }

我看不出它怎么行不通。我已经尝试过了

            td a {
            font-size:50px;
            padding:50px;
            text-align:center;
            color:white;
            display:block;
            height:100%;
            width:100%;
        }

任何帮助?

2 个答案:

答案 0 :(得分:0)

td无法通过a标记出站。尝试使用javascript作弊

<table border=1>
            <tr>
                <td onclick="window.location.href='1.php'">A</td></a>
                <td onclick="window.location.href='2.php'">B</td></a>
                <td onclick="window.location.href='3.php'">C</td></a>
            </tr>
        </table>

答案 1 :(得分:0)

a标记放入td并在您的CSS中进行一些更改,它会像您想要的那样工作

DEMO

table {
    border-collapse:collapse;
    border:white;
    background-color:#0078ff;
}
td {
    font-size:50px;
    padding:0;
    text-align:center;
    color:white;
}
table a {color:inherit; text-decoration:none}
table td a {display:block; padding:50px}
相关问题