HTML – 如何删除此表上的双边框?

前端之家收集整理的这篇文章主要介绍了HTML – 如何删除此表上的双边框?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在研究HTML和CSS,我得到的结果并不完美:

我在这里创造了一个小提琴:http://jsfiddle.net/niklasro/GParb/

但桌子的边框似乎与所需屏幕截图的边框不匹配.如何使布局看起来更像原始模型并删除表格上的双边框?

这是我对表格的CSS和HTML代码

CSS

table{ width:100%; text:align:center;border:1px solid #00F; font-size:12px;}
th{background:#EEE;width:auto; text-align:center; padding:5px 0;border:1px solid #00F;}
td{width:auto; text-align:center; padding:5px 0;border:1px solid #00F;}
tr:nth-child(even) {background: #EEE;}

HTML

<table>
    <thead>
    <tr>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
    </tr>
    </thead>
    <tbody>

    <tr>
        <td>  <a href="/admin/account/0b2bdf4f-c293-418b-a082-ef986eb94148">pelle</a></td>
        <td>  <a href="/admin/account/0b2bdf4f-c293-418b-a082-ef986eb94148">pelle@example</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/0b2bdf4f-c293-418b-a082-ef986eb94148"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/21153522-6544-4368-875a-753f4154ff9d">niklas</a></td>
        <td>  <a href="/admin/account/21153522-6544-4368-875a-753f4154ff9d">niklas</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/21153522-6544-4368-875a-753f4154ff9d"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/27053a2e-3742-4046-b876-87940c35b5bc">martin</a></td>
        <td>  <a href="/admin/account/27053a2e-3742-4046-b876-87940c35b5bc">martin</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/27053a2e-3742-4046-b876-87940c35b5bc"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/5e1947de-1185-44bb-a9f5-170df342124b">henrik</a></td>
        <td>  <a href="/admin/account/5e1947de-1185-44bb-a9f5-170df342124b">henrik</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/5e1947de-1185-44bb-a9f5-170df342124b"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/61a11f6e-e3bf-4d07-b05a-f7c3ecf0377f">niklasro@gmail.com</a></td>
        <td>  <a href="/admin/account/61a11f6e-e3bf-4d07-b05a-f7c3ecf0377f">niklasro@gmail.com</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/61a11f6e-e3bf-4d07-b05a-f7c3ecf0377f"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/83f96511-550e-4df0-bb77-e569fc0be2bc">marc</a></td>
        <td>  <a href="/admin/account/83f96511-550e-4df0-bb77-e569fc0be2bc">marc</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/83f96511-550e-4df0-bb77-e569fc0be2bc"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/95072cd9-749c-42e8-8c11-553def704f62">lukas</a></td>
        <td>  <a href="/admin/account/95072cd9-749c-42e8-8c11-553def704f62">lukas</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/95072cd9-749c-42e8-8c11-553def704f62"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/aa2d4b43-1f11-448b-bff1-0d4152c40735">rms</a></td>
        <td>  <a href="/admin/account/aa2d4b43-1f11-448b-bff1-0d4152c40735">rms</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/aa2d4b43-1f11-448b-bff1-0d4152c40735"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/c043d631-10e6-4b58-9a0f-6563199d42f7">kalle</a></td>
        <td>  <a href="/admin/account/c043d631-10e6-4b58-9a0f-6563199d42f7">kalle@example</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/c043d631-10e6-4b58-9a0f-6563199d42f7"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    <tr>
        <td>  <a href="/admin/account/f6e53781-4574-4d96-b900-204eaad6e662">blahonga</a></td>
        <td>  <a href="/admin/account/f6e53781-4574-4d96-b900-204eaad6e662">097097</a>       </td>
        <td></td>
        <td></td>
        <td><a href="/admin/editaccount/f6e53781-4574-4d96-b900-204eaad6e662"><img src="/images/edit.gif"></a><img src="/images/save.gif"><img src="/images/unlocked.gif"><img src="/images/locked.gif"> </td>
    </tr>

    </tbody>
</table>

解决方法

添加边框折叠:折叠;到表css选择器.这将消除嵌套边框外观.另外,你的文字:对齐:中心;应该是文本对齐:中心;

小提琴:http://jsfiddle.net/GParb/1/

CSS

table{
    width:100%;
    border-collapse:collapse;
    text-align:center;
    border:1px solid #00F;
    font-size:12px;
    }

与下面建议的cellspacing =“0”不同,此答案会将边框折叠为不是3D效果,就像OP要求的那样.

比较小提琴:http://jsfiddle.net/GParb/7/

猜你在找的HTML相关文章