can't convert table-based to css-based layout

This is a discussion on "can't convert table-based to css-based layout" within the Web Page Design section. This forum, and the thread "can't convert table-based to css-based layout 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 Apr 19th, 2007, 21:00
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
can't convert table-based to css-based layout

I have not been able to figure out a way to convert my very simple table-based layout to a css-based layout. The current structure is this:
Code: Select all
<table>
<tr>
<td>Navigation</td>
<td>Content</td>
</tr>
<tr>
<td colspan=2>Footer</td>
</tr>
</table>
I've tried many different CSS-based layouts, but they all fail in one way or another. The most commom problem is that sometimes the content is small, sometimes there is a lot of content that is mostly text (which wraps nicely), and sometimes the content has non-wrapping elements like SWF objects. All of the CSS-based layouts I try have been unable to handle these things the way they are handled in my simple table-based layout.

Any suggestions??

Last edited by karinne; Apr 23rd, 2007 at 13:19. Reason: Please use [code]...[/code] tags when displaying code!
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 Apr 19th, 2007, 21:43
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

I've been doing css/xhtml since January and built about 10 complete sites since then and have been able to all the tasks that you seem to be describing. One thing that I had to do was completely change my way of thinking. Instead of thinking in terms of what a table can do, you have to start thinking "how can I make this work in divs".
Sounds to me like you need to put up a header div (most people have the business name at the top), followed by two div columns.
If you need the two columns to appear to be the same length, then set both of the columns in a wrapper div.
Followed by a footer.

Header
wrapper{column 1 for nav - column 2 for content } wrapper
footer

Use floats on both columns - clear: both on the footer and you should be relatively good to go!
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 Apr 19th, 2007, 21:49
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Thanks, Lchad. I know it's weird, but I actually don't need a header.

I've tried a design like that, but when I have a SWF object (about 700px wide) and the window becomes narrower than that plus the nav column, the SWF object drops below the nav. In a table that doesn't happen, scroll bars appear. That's the sort of thing that I'm talking about being a problem.

Also, I should have added that the background is white on both the nav and the content so matching column-lengths is not an issue on this particular design.

Any other ideas?

BTW: I've tried floating the nav and giving a margin-left value to the content div and had the same result.
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 Apr 19th, 2007, 22:52
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: can't convert table-based to css-based layout

There's a link to moojoo's layouts in my footer. They have headers, but they're quite nice and should get you started. Just remove #masthead and #nav in this one:

http://www.newguyinennis.com/samples...t_left_column/
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 Apr 19th, 2007, 23:12
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Thanks, Ryan. That is a nice layout, but it doesn't work the way I need it to. Like all of the CSS-based layouts I've tried, it can't handle all 3 things I need it to handle. In this one, for instance, I replaced the content with my 700px wide SWF object. Without changing anything else, it just overhung the right side and looked terrible. With removing the WIDTH: 778px; declaration in the style sheet, it was fine when the window was large enough. But, like all of these I've found so far, when the window is made smaller, the SWF object drops below the left-side content rather than scroll bars appearing (like with my table-based layout).

This is my guess at what the problem is and it's possible (though disappointing) that there may not be a solution. A table can have a set width, and if my SWF object is bigger than that, the table will stretch to accommodate. If a div has a set width with an object floating at the left, it will not stretch to accommodate the wider object until it has tried moving it below the floated content on the left.

Thanks again to both of you for your suggestions. Any other ideas?
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 Apr 19th, 2007, 23:14
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: can't convert table-based to css-based layout

You need to make the container a fixed width. Then it won't drop below.
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 Apr 19th, 2007, 23:19
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

That would be ideal, but it needs to be a different fixed width depending on its contents. Ideally, the content div would have a width of 585px. That would work fine for almost every page on the site. But, on the pages with the 700px wide SWF object, that container needs to "grow" to accommodate that, just like a table cell does. However, it doesn't do that. It drops the SWF object below the left content, THEN grows to accommodate. Does that make sense?
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 Apr 19th, 2007, 23:27
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Yes that makes sense.
Why don't you just declare a different content div with a different fixed width?
Not all my sites are cookie cutter either. Some will have a page or two that just don't work the same as a homepage or info page. Those pages will get a little different content div with different css to accommodate.
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 Apr 19th, 2007, 23:51
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: can't convert table-based to css-based layout

Modify the damn css, thats what its for! =) Those templates are just a base not an end all solution. And flash will work if you do it right. I embed flash into divs every day. So pfffffffffffffft
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
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 Apr 20th, 2007, 00:04
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

I've modified all the layouts I've found in as many ways as I could think and I can't get one layout that meets all my needs. I'd really like to go away from a table-based layout for accessiblity purposes, but I can't do that if I can't get a CSS-based layout that doesn't "break."

I know that I could have a different template for these "special" pages, that has a wider content div, but that seems a little absurd.

BTW, the issue isn't that it's flash. The issue is that it is a wide object. It could just as easily be an image or some other object.

I'll keep looking and post again if I find a solution. In the meantime, if there are any other suggestions I'd love to hear them.
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 Apr 20th, 2007, 01:08
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Well if you needed a larger table to place 4 photos side by side would you do it? Yes you would, so why wouldn't you use a larger div to accommodate your new needs.

I'm glad you are striving to use css that's awesome. You will at times need to amend a design to work around larger or smaller elements.

Hopefully you'll find what it is you are looking for..
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 Apr 20th, 2007, 02:07
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Quote:
...if you needed a larger table to place 4 photos side by side would you do it? Yes you would...
Actually, I don't think I would have to. With a table-based layout, the table cell would "grow" to accommodate the 4 photos. With a div that has a set width, it wouldn't "grow" as needed.
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 Apr 20th, 2007, 02:08
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Ok... post a solution when you find it... I'm curious now!
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 Apr 20th, 2007, 02:16
New Member
Join Date: Apr 2007
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Quote:
when you find it
if I find it I've been searching on and off for months to no avail . . . I'm pretty close to being convinced that it isn't possible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Apr 20th, 2007, 11:48
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

Even if you do find it I'm not convinced you should use it. Making visitors scroll right and left is not good design technique whether it's tables or div.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Apr 21st, 2007, 00:05
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: can't convert table-based to css-based layout

I agree... I never run into that problem because I design my sites to work in 800 by 600 browsers. I keep mine about 900 pixels wide and if you make me scroll horizontally, I will leave your site!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Apr 24th, 2007, 17:39
Junior Member
Join Date: Apr 2007
Location: San Diego
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: can't convert table-based to css-based layout

My CSS problem is a bit different.

I can design pages in styles rather than tables that come out just fine...until the user changes the text size, smaller or larger. one size up or one size down and my page layout get blown to pieces.

g.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old Apr 24th, 2007, 18:46
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: can't convert table-based to css-based layout

Then you aren't doing it right
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19  
Old Apr 25th, 2007, 00:33
Ryan Fait's Avatar