Rebekah Rebekah - 1 month ago 15
CSS Question

clearing border in second table using css

I have created two tables on an html page, I want the first table to have a border but I don't want the second table to have one. How do I make the second table not display a border in css?



table, th, td {
border: 1px solid black;
}

th {
background-color: #4B0082;
color: white;
}


table {
border-collapse: collapse;
}

<table style="width:100%">
<tr>
<tr>
<td>table 1</td>
<td>table 1</td>
<td><TABLE style="width:100%; border: none;">
<TR>
<TD>table 2</TD>
<TD>table 2</TD>
</TR>

<TR>
<TD>table 2</TD>
<TD>table 2</TD>

</TR>
</TABLE></td>

<td>table 1</td>

</tr>




Answer

Though your code is not clear much ,i am adding a possible answer hope it helps you .use id to identify the tables uniquely.

#t1 tr td  {

border:2px solid;
width:150px;
text-align:center;


}
#t2  {

/*border:2px solid; add border if you want to row*/
width:250px;

}
<TABLE id="t1">
           <TR>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>        
    </TR>
	<TR>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>        
    </TR>
	<TR>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>
           <TD>table 1</TD>        
    </TR>
   </TABLE>

<br>
<TABLE id="t2">
           <TR>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>        
    </TR>
	<TR>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>        
    </TR>
	<TR>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>
           <TD>table 2</TD>        
    </TR>
   </TABLE>

Comments