Jump to content

Help with colspan, ahhhhhhhhhhh!


DataSpy

Recommended Posts

I'm wondering if it's possible to have one row in a table have one column, another row have 3 columns, and a third row have two columns?

 

row 1 = 1 col

row 2 = 3 col

row 3 = 2 col

 

example on my website here == http://www.data-spy.net/columns.html

 

as you can see in the example the last column doesn't go all the way over :(

 

<html>
<head>
<title>Columns suck!</title>
</head>
<body>
<table width="50%" border="1">
<tr>
   <td colspan="3">
   row 1 - 1 column - c1
   </td>
</tr>
<tr>
   <td>
   row 2 - 3 columns - c1
   </td>
   <td>
   c2
   </td>
   <td>
   c3
   </td>
</tr>
<tr colspan="2">
   <td>
   row 3 - 2 columns - c1
   </td>
   <td>
   c2
   </td>
</tr>
</table>
</body>
</html>

 

Any help greatly appreciated, thanks in advance!!!!!!!!!!!!!

Link to comment
https://forums.phpfreaks.com/topic/241622-help-with-colspan-ahhhhhhhhhhh/
Share on other sites

In the third row, you could change the colspan to 3.

 

Or you could put the first td to colspan 2 and the second td to 1.

 

Sometimes it is better to put the colspan attribute into the td rather than tr, but it depends on what you're looking for and how you want the cells to be spaced out.

Colspan 3 in row 1 and colspan 2 in row 3.

 

<table width="50%" border="1">

<tr>

  <td colspan="3">

  row 1 - 1 column - c1

  </td>

</tr>

<tr>

  <td>

  row 2 - 3 columns - c1

  </td>

  <td>

  c2

  </td>

  <td>

  c3

  </td>

</tr>

<tr colspan="2">

  <td>

  row 3 - 2 columns - c1

  </td>

  <td colspan="2">

  c2

  </td>

</tr>

</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.