Click here to Skip to main content
15,879,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i want to create a table with border-color(lets say red) and the cell borders inside the table to be in different color(lets say blue) and without displaying the borders of the table as 2 lines.
is it applicable without making the borders of the outer td colored red??
Thanks
Posted
Comments
Amrut Bidri 1-Apr-12 2:53am    
are you providing id to each td element if yes, it'll help.

1 solution

HTML
<table>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
</table>

CSS
table{border: 1px solid red}
table td{border: 1px solid blue}
table tr:first-child td{border-top:none}
table tr:last-child td{border-bottom:none}
table tr td:first-child{border-left:none}
table tr td:last-child{border-right:none}


but as i know first child and last child are not fully compatible with IE, i've tried with ie9 and works ok, you should try in every browser

or you can use classes to get the first and the last row, and the first and the last column


or more you can change the color with js
 
Share this answer
 
v3
Comments
Rojeh 11-Apr-12 16:04pm    
10x i'll try it later on

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900