Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing unwanted table cell borders with CSS

I have a peculiar and frustrating problem. For the simple markup:

<table>     <thead>         <tr><th>1</th><th>2</th><th>3</th></tr>      </thead>     <tbody>         <tr><td>a</td><td>b></td><td>c</td></tr>         <tr class='odd'><td>x</td><td>y</td><td>z</td></tr>     </tbody> </table> 

I apply different background-color values to the thead, tr, and tr odd elements. The problem is that in most browsers, every cell has an unwanted border which is not the color of any of the table rows. Only in Firefox 3.5 does the table have no borders in any cell.

I'd just like to know how to remove these borders in the other major browsers so that the only thing you see in the table are the alternating row colors.

like image 810
Bob Avatar asked Jan 11 '10 01:01

Bob


People also ask

How do I get rid of the border in CSS?

We can specify the no border property using CSS border: none, border-width : 0, border : 0 properties. Approach 1: We will give border-color, border-style properties to both headings, for showing text with border and no-border. For no border heading, we will use the border-width : 0 which will result in no border.

How do I make my table border invisible in HTML?

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

You need to add this to your CSS:

table { border-collapse:collapse } 
like image 100
Doug Neiner Avatar answered Sep 20 '22 09:09

Doug Neiner


to remove the border , juste using css like this :

td {  border-style : hidden!important; } 
like image 34
Aouidane Med Amine Avatar answered Sep 19 '22 09:09

Aouidane Med Amine