Anders
Anders

Reputation: 12726

Invisible borders in html table not quite invisible?

I have some tables in my asp.net MVC application for layout purposes. Even though I usually use divs for most things, in some cases tables make most sense because they already have exactly the layout I'm after in these cases.

The only problem is, as far as I know the borders are supposed to be invisible unless you specify a width and style for the borders. But they aren't... They are rather vague, yes, but there are still light blue borders around each cell. What is that and how do I get rid of them? (Funny thing is I don't remember having seen this before when I used tables, which was a while ago).

I also tried specifically setting the border to 0px on both table and td, but that didn't work either...

Upvotes: 1

Views: 3969

Answers (5)

wsanville
wsanville

Reputation: 37516

The CSS property border-collapse is used to achieve this effect. It will make adjacent cells share the same border. This property has the same end effect as the deprecated cellspacing attribute for tables.

table { border-collapse: collapse; }

Upvotes: 1

shijas km
shijas km

Reputation: 11

Same issue i also faced the problem is css inheriting...may be you are not given in class check for table or table td css in any of your css files in the solution

and make to 0px

table 
{
  border: solid 0px #e8eef4;
  border-collapse: collapse;
}

table td 
{
  padding: 5px;   
  border: solid 0px #e8eef4;
}

Upvotes: 0

Anders
Anders

Reputation: 12726

Well, it turns out it was just a mistake on my part, the css selector wasn't accurate enough. I don't know why, but it didn't work just saying td{border:none;}, I had to specify table tr td{border:none;}, and then it worked...

Upvotes: 0

Gitesh Dang
Gitesh Dang

Reputation: 182

You can use cellspacing attribute in table tag

<table cellspacing='0' border='0'>

Upvotes: 1

Robert
Robert

Reputation: 21388

Have you tried border: none for CSS or border='0' in the table declaration?

Upvotes: 1

Related Questions