CSS和HTML的问题 - 边界半径和背景颜色

时间:2013-06-28 18:35:37

标签: html css3 web

我的设计有一个小问题。问题是表格顶部或底部的行的背景颜色似乎是“悬在”边缘。我认为背景颜色仍然适用于桌面风格,但无法想象我的生活(我不是设计师!)。 Jfiddle在这里:

http://jsfiddle.net/UFcqB/

HTML:

<div class="stats_table">
        <table cellspacing="0">
            <tr class="tablehead">
                <th>ID</th>
                <th>Name</th>
                <th>Contact Person</th> 
                <th>Contact Number</th>
                <th>Email Address</th>
                <th>Status</th>
                <th>Location</th>
                <th class="modify">Options</th>
            </tr>
            <tr class="second_row">
                <td>1</td>
                <td>Test Agency cc.</td><td>John Doe</td>
                <td>0112131232</td>
                <td><a target="_blank" href="mailto:jd@testagency.co.za">jd@testagency.co.za</a>    </td>
                <td>Active</td>
                <td>Hatfield</td>
                <td class="modify">
                    <a onclick="return false;" href="#"><img title="View Agency Details" src="img/icons/list_small.png"></a>
                    <a onclick="return false;" href="#"><img title="Disable Agency" src="img/icons/delete_small.png"></a>
                </td>

            </tr>
        </table>
</div>

CSS:

table {
    background: none repeat scroll 0 0 #FFFFFF;
    border: 1px solid #E2E2E2;
    border-collapse: separate;
    border-radius: 20px 20px 20px 20px;
    moz-border-radius: 20px 20px 20px 20px;
    box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1);
    line-height: 1;
    font-size: 12px;
    width: 100%;
}

th {
    padding: 5px 10px 5px 10px;
}

td {
    padding: 5px 10px 5px 10px;
    text-align: left;
}

.tablehead {
    background-color: #E9E9EA;
    color: #747070;
    text-align: left;
}

.second_row {
    background-color: #DFEFFC;
}

感谢您的帮助!

2 个答案:

答案 0 :(得分:7)

如果你添加:

 overflow: hidden;

到表的CSS,它将隐藏行的角落。

答案 1 :(得分:1)

点击此处: http://jsfiddle.net/balintbako/UAVxB/

您必须将边框半径添加到角落的<th><td>

这里有一段很长的谈话(我把css从这里复制到了小提琴):CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?

相关问题