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.
|
|
|
|
|
![]() |
||
Am I using table-cell and table-row too much?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
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.
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. |
|
#4
|
||||
|
||||
|
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.
|
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
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.
|
|
#9
|
|||
|
|||
|
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? |
|
#10
|
||||
|
||||
|
Re: Am I using table-cell and table-row too much?
Quote:
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.
Last Blog Entry: Giving them what they paid for: A (sort of) Follow-up (Oct 15th, 2008)
|
|
#11
|
|||
|
|||
|
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'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. |
|
#12
|
||||
|
||||
|
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.
|
|
#13
|
||||
|
||||
|
Re: Am I using table-cell and table-row too much?
Quote:
Sweet that ur in Notts too, You go to Trent or NU?
Last Blog Entry: Giving them what they paid for: A (sort of) Follow-up (Oct 15th, 2008)
|
|
#14
|
|||
|
|||
|
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 |