Jump to content
xisto Community
KansukeKojima

Can You Put Tables Inside Of Tables?

Recommended Posts

Well... could you? Specifically I mean can you place a <table> tag in a <td></td> tag which are already parts of tables.... if so, how do you go about doing it?

Share this post


Link to post
Share on other sites

Yes, as far as I know this is possible and works ok - most of old sites, which did not use CSS for the layout of the page, all used nested tables or tables inside tables to create a layout.

You should know that tables are not the most preffered method of creating layouts, because they are very hard to maintain and there are also other bad sides of doing that.

If you want to create a good layout, learn CSS or cascading style sheets, because it really is worth it. Plus the concept is actually very simple once you get used to it...

Yeah, I almost forgot..how you do it (if you want to stick with nested tables):

<table>  <tr>	<td>	  <table>...</table>	</td>  </tr></table>

Edited by heavensounds (see edit history)

Share this post


Link to post
Share on other sites

Alright haha, thanks...By the way, I know how to use CSS, but .... I don't have the expierience or skill to create a template to use yet, I use css in conjuction with my tables... Its mostly basic css............ I should probably practice that.....

Share this post


Link to post
Share on other sites

Yes of course you can... I use nested tables for a lot of stuff. Not a big fan of div layers and I believe css should be for setting colors and styles and stuff not actually constructing the whole template with it. I would use colspan and rowspan because that way i would be able to do everything I could do with a nested table except do it all with one table, but I've found firefox gets very confused when you get a little too excited with it. Almost all of my layouts that i try to do with one table with the help of colspan and rowspan looks great in safari, camino, and *gulp* (as much as I hate to say it) IE, but firefox messes them all up. Sigh, I'm still on the search for the perfect browser...

Edited by alex7h3pr0gr4m3r (see edit history)

Share this post


Link to post
Share on other sites

Yes, you can, but it means you're damned for eternity :P

 

Bear in mind that tables for layout brings many other problems rather than just difficult to read code, such as broken layouts whenever either the user stylesheet or the browser stylesheet (which shouldn't, but is known to with some of the more cheeky browsers) overrides your 'borders=0'. If nothing else, try using Lynx (a popular screen reader) to 'hear' your site - not only is this how many partially sighted and all blind users interact with your sight, but it makes it clear how your code is semantically incomprehensible.

 

Also, if your code renders correctly in those browsers, and not Firefox (and more conspicuously, Opera) then you are relying on the incorrect display of those browsers. Not that there's anything wrong with catering for IE and its ~80% market share, but it's pretty well known that you can write valid xhtml (even transitional 1.0) according to the w3c specifications that IE cannot render correctly. If nothing else, as soon as you play with margins and padding you can bet your bottom dollar that IE has it wrong thanks to MS's flawed interpretation of the box model.

 

I'm sure you already knew that Alex, but it winds me up sometimes when people code for IE, and then moan about FF and Opera...almost as much as people that spout standards-compliance on one hand, and then code for IE (not that you were doing either of those :D ).

 

Anyway, I've fallen off topic. Tables are superb for displaying data, and are unfortunately being avoided by many for this thanks to the general bad press they get for layouts. However, that doesn't change the fact that using them for layout is bad practice, and getting into the form/function separation that CSS should teach you is a good habit for the long term. I think this is relevant, because the majority of situations I've seen where nested tables are used are cases where a table shouldn't be used at all - your table either needs additional columns/rows which are 'joined' by col/rowspan as Alex pointed out, or you should have just the data you want to nest in a table located within a div.

 

That's my 2 cents - I do appreciate that the jury is still out on table usage, but I'm not a big fan - I'm sure it can be done well, but not as easily once someone knows an equivalent level of CSS.

Share this post


Link to post
Share on other sites

Thanks for your opinion... I was only planning on using nested tables for my portfolio... so when the page loads, the image is displayed with the text how I wanted it.... but not for my layout...Also, for the next version of my website, I'm looking towards a css layout... I'll have to practice how to set it up though...

Edited by KansukeKojima (see edit history)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.