rahularyansharma rahularyansharma - 1 year ago 69
CSS Question

Give second or fourth column right side border using css in Internet Explorer

I just want to give second and fourth

<td >
right side border ...

as you can see I have following table:

<table class="secondtd">
<td> Name </td>
<td> Class </td>
<td> RollNo </td>
<td> Batch </td>

I have tried something like this in css

.secondtd td+td {
border-right:solid 1px red;

but not work for me .. I am using IE .

Answer Source

You could assign the class two the 2nd and 4th element of the tables:

 <td class="secondborder"> </td>

Or you could use nth-child:

td:nth-child(2), td:nth-child(4) {
 border-right:thick double #ff0000;


Which would select the 2nd and 4th element. If you only have 4 td's you could use even:

td:nth-child(even) {
  border-right:thick double #ff0000;



From the comments to do this with a class applied:

.secondtd td:nth-child(2) {
  border-right:thick double #ff0000;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download