user3002211
user3002211

Reputation: 183

Table won't display in browser

I'm writing a code for the following table and it doesn't seem to display in the browser. I checked my code to see if there is some typo, and I can't find any.

Here's what the table has to look like: enter image description here

And here's my code:

<html>
<body>
<table>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td colspan=3> </td>
    <td> </td>
    <td> </td>
  </tr>
 <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td rowspan=2></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

Upvotes: 1

Views: 6039

Answers (3)

nkmol
nkmol

Reputation: 8091

You can use the HTML border, width and height attribute of the table:

<table border="1" width=500px height=500px>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td colspan=3> </td>
    <td> </td>
    <td> </td>
  </tr>
 <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td rowspan=2></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>

This is how we did this when we started learning HTML :)

jsFiddle

Upvotes: 2

Ibu
Ibu

Reputation: 43810

The table is invisible until you add styling and data to it.

CSS:

table {
    border-collapse:collapse;
}

table td {
   border:1px solid #000;
}

Without CSS but not recommended is to use the border attribute:

<table border="1" cellspacing="0">

Upvotes: 4

Leptonator
Leptonator

Reputation: 3499

This works.. I just tested it..

<html>
<body>
<table border=1>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan=3>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
 <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td rowspan=2>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Upvotes: 2

Related Questions