简体   繁体   中英

Issues with CSS and HTML - Border Radius and Background Color

I have a small issue with some design. Problem is that the background colour of a row at the top or the bottom of the table seems to be "hanging over" the edges. I think that the background colour is still applying the table style, but cannot figure this out for the life of me (I'm not a designer!). Jfiddle here:

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;
}

Thanks for any help!

If you add:

 overflow: hidden;

to the CSS of table, it will hide the corners of the rows.

Check here: http://jsfiddle.net/balintbako/UAVxB/

You have to add the border-radius to the <th> s and <td> s on the corner.

There is a quite long conversation here (I copied the css from here to the fiddle): 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM