1

I had created a sample HTML for Table where I have 3 columns and 2 rows.

    <!DOCTYPE html>
<html>
<body>
    <table border='1' width='400px' cellspacing="0" cellpadding="2" height='100%' style='color: black;'>
        <tr style='color: #fff; background: black;'>
            <th>column1</th>
            <th>column2</th>
            <th>column3</th>
        </tr>
        <tr>
            <td></td><td> </td><td> 1234</td>
        </tr>
        <tr>
            <td> 190</td><td> 2</td><td>454545</td>
        </tr>
    </table>
</body>
</html>

The table created successfully but the separator is missing between the columns where the data is not available. This issue occured only in IE, in Mozilla it works fine. Can anyone help me to find out a solution for this? Printscreen

7
  • 3
    Try this <tr><td>&nbsp;</td><td>&nbsp;</td><td> 1234</td></tr> Commented Nov 22, 2013 at 6:43
  • iam getting this values from the database so that i cannot modify the content but only the structure. Commented Nov 22, 2013 at 6:44
  • Which version of IE ? it works perfectly in chrome/safari/firefox Commented Nov 22, 2013 at 6:45
  • using empty($row['column1']) to check the value is empty or not. You can implementation by this <td><?=( empty($row['column1']) ) ? '&nbsp;' : $row['column1'] ?></td> Commented Nov 22, 2013 at 6:48
  • I dont want to change the content. my question is What changes in the table structure will give right OP? Commented Nov 22, 2013 at 6:53

3 Answers 3

1

You can fix this by defining exact border style for both table as well as td tags, by doing this you prevent browser from applying its own styling. Remove border='1' and define

table {
border: 1px solid #3C2610;
}

td {
border: 1px solid #3C2610;
}

The cell dosn't exist in some IE's unless it's filled with something. If you can put a &nbsp; (non breaking space) to fill the void, that will usually work.

Apparently, IE8 shows the cells by default, and you have to hide it with empty-cells:hide But it doesn't work at all in IE7 (which hides by default)

Another solution is adding these two attributes to the table element: frame="box" and rules="all" like this:

<table border="1" cellspacing="0" frame="box" rules="all">
Sign up to request clarification or add additional context in comments.

Comments

0

Would putting a non breaking space (&nbsp;) into the empty column work?

Comments

0

Try adding &nbsp; in between td tag, such as <tr><td>&nbsp;</td><td>&nbsp;</td><td> 1234</td></tr> in HTML

3 Comments

In first line, I have provided for HTML
Just provide an idea for in dynamic language. But now I have removed taht from my answer. Thanks @ ling.s
@ChinnuR I know if im changing the content it will give the OP. But since my result set may huge and validating will effect the performance i need to find out a way to fix this in HTML.When mozilla,chrome gives the right OP why only IE shows such a ugly structure?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.