I am trying to create rounded corners for my 3 column table (CSS table). I used:
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
in my CSS, but what I get is the top image. What I want it to look like is the bottom image.
Is there any way that this can be done?
table { border-radius:10px; }
If you want to do each row, use the CSS pseudo-classes :first-child
and :last-child
.
Demo: http://jsfiddle.net/ThinkingStiff/R792K/
CSS:
table { border-spacing: 0; }
td {
border-top: 1px solid black;
border-left: 1px solid black;
border-bottom: 1px solid black;
padding: 10px;
}
td:first-child {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
td:last-child {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-right: 1px solid black;
}
HTML:
<table>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
<tr><td>7</td><td>8</td><td>9</td></tr>
</table>
我建议将整个表包含在<div>
,然后四舍五入该div的角
TD:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
TD:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
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.