Qbasicnews.com

Full Version: Stupid HTML question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want a table cell to span all columns in a table. There are 2 columns. But this doesn't work, for some reason:
Code:
<table>
<tr><td>blarg</td><td>blarg2</td></tr>
<tr><td colspan=2>blarg3</td></tr>
</table>
How can I make it produce the desired effect? I looked it up at w3schools, and they said to do just what I did, and it didn't work.
There's nothing wrong with that code, apart from:

* no quotes around the 2
* you might have to make the table width="100%" to see the difference (also give it border="1" to see that it works)
1) Yes, I'll put quotes, but that doesn't make a difference.
2) I don't want it to be width="100%". And believe me, I've made it width=65%, and the <td colspan="2"> in the second <tr> is squished into the far right of the table, only under the second <td> in the first <tr>.
That's real wierd...

It's not something in your stylesheets? No?

Try this:

Code:
<table cellspacing="0" cellpadding="0" width="80%" border="1">
  <tr>
    <td colspan="2">Blarg!</td>
  </tr>
  <tr>
    <td>Blorg!</td>
    <td>Blerg!</td>
  </tr>
</table>

Upload that and gimme the url if it doesn't work.
Hmm, that works.
I think the only difference is that the colspan="2" is on the bottom tr, rather than the top.
Try it on the bottom then Smile
Weird. It works. But not on mine. :???:
the first example worked for me. would this be a browser issue?
Eh, I was generating it with php - and it was a complicated string. Probably just a small quirk. I fixed it.