Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

Am I using table-cell and table-row too much?

This is a discussion on "Am I using table-cell and table-row too much?" within the Web Page Design section. This forum, and the thread "Am I using table-cell and table-row too much? are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 2nd, 2006, 15:31
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Am I using table-cell and table-row too much?

Hey,

I'm just making the switch to doing my layouts in CSS, yet I feel I'm just using display: table-cell and table-row all over the place to compensate.

Is there a different prefered method of making DIVs loose thier line breaking habbits?

Cheers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old Sep 2nd, 2006, 18:00
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

Yes, you should never use those properties. Most browsers don't support them anyway. Use display: inline; as it has a similar effect. If you have any CSS (preferably with a website), post it and I'll go through it explaining some better methods to acheive the same effects.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 2nd, 2006, 19:41
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

I don't have my site online just yet, though I've written a little test page for my most common layouts.

Code: Select all
Test 1
<br />
<div style="display: inline; border: 1px solid #f00;">DIV1</div><div style="display: inline; height: 500px; border: 1px solid #f00;">DIV2</div>
<br /><br />
Test 2
<br />
<div style="display: inline; height: 100px; border: 1px solid #f00;">DIV4</div>
<div style="display: inline; height: 100px; border: 1px solid #f00;">
  <div style="height: 100px; border: 1px solid #f00">DIV5</div>
  <div style="height: 100px; border: 1px solid #f00">DIV6</div>
</div>
Test 1 is fine, but Test 2 fails horribly. I want two inline divs, but with one containing two normal divs. What should I do in this sittuation?

Also, I can't set the width or height on the inline divs

I really do wonder why so many people rant about doing layouts in CSS, tables are so much quicker.. and actually work in all browsers,

Thanks for your help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 2nd, 2006, 20:29
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

It would help to know what you're doing. When you get the gist of CSS, you'll understand that tables just don't compare. From positioning, layering, aligning and organizing to management, editing and loading time, CSS is better than tables in almost every aspect of web design.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 3rd, 2006, 12:15
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

I'm just writting a few layout tests, so that I know how to go from the table-cell/table-row combination to its inline equivalent.

Any help getting Test 2 in the code I posted working is greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 3rd, 2006, 15:35
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

Divs are naturally what are known as 'block level' elements. What that means is that they will spread themselves to the full width of the space available to them.

I'm assuming from your code that you wanted the two inner divs to be side by side. This will not happen unless you give them a width such that they can fit side by side within the width of the contaning div.

I also don't think you are in a position yet to understand when you need to specify the style of a div as being 'inline'. Most of the time this will not be necessary at all.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Sep 3rd, 2006, 21:37
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

I wanted the two inner divs to display as they over, one above the other (hence the no display: inline), it's their parent DIV that I wanted to display inline with DIV4.

Table equivalent:

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



Last edited by idl; Sep 3rd, 2006 at 21:40.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Sep 3rd, 2006, 22:49
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

Well the same rules apply. You need to specify widths for the divs so they fit in the allocated space.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Sep 3rd, 2006, 23:36
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

OK, so inline obviously what I want as it always takes the minimum height and width possible.

I've managed to create what I wanted using a left floating div with the one to right having a left margin of the same width. Apparently in CSS this isn't a hack but it sure feels like it. I still don't see why people like CSS.. the number of sites you find on goolge with people having problems is staggering. I'm not saying tables should be used for layouts, I just think CSS is a little esoteric. I certainly wouldn't call its layout capabilities elegant.

I really want someone to point something out to me that just makes it all click in my head

I find application based GUI layouts easier to create than CSS (GTK+ especially, though maybe not swing). I just don't see why whoever designed CSS didn't make it a tad easier?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Sep 4th, 2006, 15:03
minute44's Avatar
Most Reputable Member

SuperMember
Join Date: Apr 2006
Location: Nottingham UK
Age: 25
Posts: 1,361
Blog Entries: 3
Thanks: 0
Thanked 1 Time in 1 Post
Re: Am I using table-cell and table-row too much?

Quote:
Originally Posted by idl View Post

I really want someone to point something out to me that just makes it all click in my head

I find application based GUI layouts easier to create than CSS (GTK+ especially, though maybe not swing). I just don't see why whoever designed CSS didn't make it a tad easier?
Ahhh, if only it were that simple. CSS is only as complicated as it needs to be.

Tell you what. THis is how I first got to grips with CSS layout.

Build a page with a container div containing 3 other divs. Put a couple of paragraphs in each of the 3 inside divs. THen go to this site and download SimpleCSS.

You say that graphical editors are easier for you... this is a GUI CSS editor. What you need to do is make styes for all of the divs on your test page (#container, #one, #two and #three) change properties and see how the changes you make affect the divs on the page. You'll soon get to grips with what properties change what on the layout.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Sep 4th, 2006, 15:11
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

I mean't that I find writting desktop applications layout easier than CSS (MFC, Qt, GTK+ etc), not that I use a GUI for creating my interfaces I like to use a text editor to design my sites.

I'm getting the hang of floating DIVs now, so I shouldn't ever need table-cell again

Thanks everyone for your help.

P.S Notts here too (during term time anyway)

Last edited by idl; Sep 4th, 2006 at 15:15.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Sep 5th, 2006, 03:15
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

You may prefer a plain text editor, but jumping straight into the deep end with hundreds of CSS properties and even more variables means, like you've already discovered, that you're going to go about things the wrong way. CSS is such an ambiguous language, you could make some sites look the same with 15 entirely different stylesheets. The real problem is finding out which methods are best and whether or not their outcomes work in all browsers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Sep 5th, 2006, 08:41
minute44's Avatar
Most Reputable Member

SuperMember
Join Date: Apr 2006
Location: Nottingham UK
Age: 25
Posts: 1,361
Blog Entries: 3
Thanks: 0
Thanked 1 Time in 1 Post
Re: Am I using table-cell and table-row too much?

Quote:
Originally Posted by idl View Post
I mean't that I find writting desktop applications layout easier than CSS (MFC, Qt, GTK+ etc), not that I use a GUI for creating my interfaces I like to use a text editor to design my sites.

I'm getting the hang of floating DIVs now, so I shouldn't ever need table-cell again

Thanks everyone for your help.

P.S Notts here too (during term time anyway)
Fair enough, I guess I got the wrong end of the stick... but still I found that piece of software really helpfull when I first picked up CSS. Give it a go..

Sweet that ur in Notts too, You go to Trent or NU?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Sep 5th, 2006, 10:02
idl idl is offline
New Member
Join Date: Sep 2006
Location: UK
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Am I using table-cell and table-row too much?

I've been using CSS for quite a while, jut never for layouts, so I'm not that overwhelmed. But of course layouts are the biggest obstacle so still lots to learn.

I go to Trent, didn't work hard enough at my A levels for NU
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!