Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with <table style="border-collapse:collapse"> Part of right border is cut off (screenshots attached)

Tags:

html

css

I'm a new web developer (obviously). When I first noticed this issue, I thought it might be something quirky with the site I was working on. Since then I've worked on several other sites and noticed the same thing.

When I use the CSS property "border-collapse:collapse" to stylize HTML tables, sometimes the far-right border gets cut off when I load the page (both in FF and IE). Strangely enough, when I scroll up and down it occasionally fixes itself without reloading the page. It usually happens toward the bottom-right corner of the table, as the second screenshot indicates.

screenshot1

screenshot2

Here's my HTML/CSS:

<table width="730" border="0" cellpadding="4" cellspacing="0" style="border-collapse: collapse;">
  <tr>
    <td style="border:1px solid #ff9900;"></td>
    <td style="border:1px solid #ff9900;"></td>
    <td style="border:1px solid #ff9900;"></td>
  </tr>
.
.
.
</table>

What gives? Any ideas? Thanks for your time & effort!

like image 977
Newbie Aspiring Programmer Avatar asked Mar 05 '12 22:03

Newbie Aspiring Programmer


People also ask

How do you fix a table border in HTML?

To create table border in HTML, the border attribute was used. But the introduction of HTML5, deprecated the border tag. Create table border using the CSS property border. Set table border as well as border for <th> and <td>.

What is the difference between border-collapse collapse and border-collapse separate?

They are Different!In the separated model, adjacent cells each have their own distinct borders. In the collapsed model, adjacent table cells share borders. The border-spacing CSS property specifies the distance between the borders of adjacent table cells (only for the separated borders model).

Which of the following is used to collapse the border of the table?

The border-collapse CSS property sets whether cells inside a <table> have shared or separate borders.


1 Answers

Moz has problems with border-collapse:collapse; going back 10 years or so, it keeps getting fixed and then becoming buggy again (see bug track here and here).

Try adding a border to the table element like so:-

#your-table-name {border-collapse : collapse; border : 1px solid orange;}

#your-table-name td {border: 1px solid orange;}

Please also note that this is a coding question and should really go to stackoverflow. Its also helpful to post the browser version you're using.

like image 193
toomanyairmiles Avatar answered Oct 12 '22 19:10

toomanyairmiles