lister Posted October 4, 2006 Share Posted October 4, 2006 I have been asked by our teacher to create a basic table which has rows and columnssome rows and columns span accross using the colspan or rowspan.here is the example:http://www.twistedjunkie.eclipse.co.uk/example.pdfI have manged to apply the code and get the table to workusing the code below, could someone tell me if I have donethis right? It does work, but as I'm a newbie I did get stuckon the last row/rowspan.....<html><head><title>Table Assignment</title></head><table border="1" width="400"><tr><td>1</td><td>2</td></tr><tr><td colspan="2">3</td></tr><tr><td rowspan="2">4</td><td>5</td></tr><tr><td>6</td></tr><tr><td colspan="2">7</td></tr><tr><td>8</td><td>9</td></tr><td rowspan="2">10</td></tr><tr><td rowspan="2">12</td></tr><td>11</td></table></html>thanks for your helplister Link to comment Share on other sites More sharing options...
reportingsjr Posted October 4, 2006 Share Posted October 4, 2006 ok, pretty much its this:colspan -- if one row of your table has 2 columns, and the next one has 1 then the bottom row will only show one small column that stops where the first column of the first row does. So you end up with something like this: |_ROW 1 COLUMN 1_|_ROW 1 COLUMN 2_||_ROW 2 COLUMN 1_|________________| See how there is just a big blank space you dont want, well on row 2 column one if you wanted it to stretch across those 2 columns you would add colspan="2' and the result would be this: |_ROW 1 COLUMN 1_|_ROW 1 COLUMN 2_||_________ROW 2 COLUMN 1__________| Now for rowspan:pretty much same principle except for instead of going across however many columns, it goes down however many rows. So if you had this: |_ROW 1 COLUMN 1_|_ROW 1 COLUMN 2_||_ROW 2 COLUMN 1_|________________| and you wanted ROW 1 COLUMN 2 to stretch down and be in line with ROW 2 COLUMN 1 also you would add rowspan="2" and the result would be this: |_ROW 1 COLUMN 1_|_ROW 1 COLUMN 2_| |_ROW 2 COLUMN 1_| | and the text ROW 1 COLUMN 2 would be centered in the middle there. Link to comment Share on other sites More sharing options...
holmedwa04 Posted October 5, 2006 Share Posted October 5, 2006 Your code seems to be alright to me, there were a few things that I noticed, they were that you havn't used a body code and you had missed out a tr tag, but appart from that it is fine.You could use nested tables to achive the effect that you want instead of using row and col span, here is an example of a nested table: <table border="1"><tr><td><table border="1"><tr><td>1</td></tr><tr><td>2</td></tr></table></td><td>3</td></tr></table> If you like I will post the code for the table you want to make using nested tables? Link to comment Share on other sites More sharing options...
lister Posted October 6, 2006 Author Share Posted October 6, 2006 thanks for your help....gonna check out the tips..lister Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now