Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the border for specified rows of a table?

I want to hide the border for a specific rows of a table.How to do it?
Any Idea?
Sample code is Highly Appreciated.

like image 905
Mr.Chowdary Avatar asked Jul 17 '12 06:07

Mr.Chowdary


People also ask

How do you remove a border from a specific row?

noBorder td to make the border go away for all the <td> s that are inside of <tr> s with the noBorder class by assigning border: 0 . Note that you do not need to provide the unit (i.e. px ) if you set something to 0 as it does not matter anyway. Zero is just zero.

How do I hide table borders?

Remove all borders to select the table and show the Table Design tab. On the Table Design tab, click the arrow next to Borders and then click No Border . Tip: Be sure to click Borders not Border Styles.

How do you remove borders from a table cell?

To remove borders between cells, while retaining the border around the table, add the attribute rules=none to the table tag.

How do I make my table border invisible in HTML?

To make a table with a border of 2 pixels, just add BORDER=”2″ to the <TABLE> tag. To make an invisible border, set the BORDER attribute to 0. (Although most browsers default to a table border of 0, specifically stating it ensures that the border will be invisible in all browsers.)


2 Answers

Use the CSS property border on the <td>s following the <tr>s you do not want to have the border.

In my example I made a class noBorder that I gave to one <tr>. Then I use a simple selector tr.noBorder td to make the border go away for all the <td>s that are inside of <tr>s with the noBorder class by assigning border: 0.

Note that you do not need to provide the unit (i.e. px) if you set something to 0 as it does not matter anyway. Zero is just zero.

table, tr, td {    border: 3px solid red;  }  tr.noBorder td {    border: 0;  }
<table>    <tr>      <td>A1</td>      <td>B1</td>      <td>C1</td>    </tr>    <tr class="noBorder">      <td>A2</td>      <td>B2</td>      <td>C2</td>    </tr>    <tr>      <td>A3</td>      <td>A3</td>      <td>A3</td>    </tr>  </table>

Here's the output as an image:

Output from HTML

like image 92
simbabque Avatar answered Sep 18 '22 05:09

simbabque


I use this with good results:

border-style:hidden; 

It also works for:

border-right-style:hidden; /*if you want to hide just a border on a cell*/ 

Example:

<style type="text/css">        table, th, td {         border: 2px solid green;        }        tr.hide_right > td, td.hide_right{          border-right-style:hidden;        }        tr.hide_all > td, td.hide_all{          border-style:hidden;        }    }  </style>  <table>    <tr>      <td class="hide_right">11</td>      <td>12</td>      <td class="hide_all">13</td>    </tr>    <tr class="hide_right">      <td>21</td>      <td>22</td>      <td>23</td>    </tr>    <tr class="hide_all">      <td>31</td>      <td>32</td>      <td>33</td>    </tr>  </table>

Here is the result: enter image description here

like image 26
Carlos Toledo Avatar answered Sep 20 '22 05:09

Carlos Toledo