Click to See Complete Forum and Search --> : Can you SPAN across tables?
JSchwarz
06-02-2004, 03:05 PM
Who knows why SPAN code similar to the following doesn't work? It seems to have something to do with embedding it within tables or across tables or something like that. I want to use the SPAN to hide and show parts of the form based on previous selections on the form.
<table>
<tr><td>yada, yada, yada...</td></tr>
<tr><td><SPAN id="Property" style="display:none"></td></tr>
</table>
<table>
<tr><td>Describe Property:</td>
<td></SPAN></td><td></td></tr>
<tr><td></td></tr>
</table>
How do I work around it?
Thanks.
Jeff
PS: Fixed the typo. This code is not cut and pasted from my page (the real code is much too long to post here).
JPnyc
06-02-2004, 04:42 PM
Well 1st off if that's copied and pasted from your page, then you have a typo <tdD>. But if that's not it, then why not just use 2 spans and change the display on both?
JPnyc
06-02-2004, 05:21 PM
Well 1st off if that's copied and pasted from your page, then you have a typo <tdD>. But if that's not it, then why not just use 2 spans and change the display on both?
JSchwarz
06-03-2004, 08:02 AM
I eventually worked around the issue by creating new tables and SPANning each table individually. The problem with that approach is the customer doesn't like the layout.
The same issue (the customer doesn't like the layout) prevents me from using two SPANs.
Note that I fixed the typo you mentioned.
Thanks for the feedback.
Jeff
vswami
06-07-2004, 08:36 AM
What I noticed with SPAN was it was not very table friendly. I tried to SPAN just one part of the table and it didn't like that.
Like you I had to create multiple table within the table and ruin the layout.
If there is a workaround, I would appriciate hearing it.
Thanks.
David Harrison
06-07-2004, 10:04 AM
There is a work around, a very good one in fact. It's called not using tabels for layout and only using them for tabulated data.
Use proper semantic markup and CSS, it'll clean up your code and who knows, maybe you'll be able to do what you want.
I don't know exactly what you are trying to do so I can't say for certain if it is possible.
The code you posted doesn't work because you are supposed to close tags in the reverse order to when you opened then.
You have opened a table, tr, td and a span, then closed the td, tr and table, opened a new table, tr and td etc. It's terrible and doesn't make any sense.
Think of tags as boxes, you put a box inside a box, you have to close the lid of the box on the inside before you close the lid of the box on the outside.
JSchwarz
06-07-2004, 02:24 PM
lavalamp, I'm pretty new to web development, so maybe you could shine a little light on how to get started please. What would be a good semantic markup and CSS to use for creating tables (or laying stuff out in table format)? Even if you can just give me the keywords, etc. to look up, that would be a great start for me. Thanks,
Jeff
David Harrison
06-07-2004, 02:35 PM
Well by markup I mean HTML (HyperText Markup Language). The only time you should use a table is to display tabular data.
Semantic markup is using the correct tag for the data it contains. For example if you have a list of links, rather than using a table with a different tr for each row, you should use an unordered list:<ul>
<li>Here's a link.</li>
<li>Here's another.</li>
<li>Guess what?</li>
<li>That was a link and so is this.</li>
</ul>I have omitted the link code here for simplicity.
If you don't like the default rendering of the list items then you can alter it with styles.
Above all else, what you should do is get a good book to teach yourself HTML and CSS. Once upon a time I got a copy of "Elizabeth Castrows HTML for the World Wide Web 5th Edition with XHTML and CSS". That's a very good book that goes into detail about each element of HTML and every rule of CSS.
There is a very good reference guide in the back of the book as well for if you forget something and need to look it up quick.