Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2011, 02:21 PM   PM User | #1
levicki
New Coder

 
Join Date: Mar 2009
Posts: 18
Thanks: 3
Thanked 2 Times in 2 Posts
levicki is on a distinguished road
Cool Need advice on converting from tables to CSS layout

So, as the title says, I have a website which was created using ImageReady which uses tables extensively for layout and positioning.

Does anyone have any advice on how to migrate this to CSS and DIVs? Automated conversion is highly preferable because each page has repeated elements such as menus and images which I would like to refactor anyway to use SSI. Website will be hosted on Linux hosting (PHP is therefore available).
levicki is offline   Reply With Quote
Old 11-21-2011, 02:54 PM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
There is no automate conversion in web development. You should create the elements (divs) and you should create your CSS classes by hand, writing the code lines.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 11-21-2011, 06:32 PM   PM User | #3
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,585
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
If you have repetetive code/tasks you might be able to do a multi-file search and replace. Create one page template with semantic HTML and an appendant stylesheet and then, for example, replace the header and the footer in each HTML file automatically with what you have created.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 11-23-2011, 12:02 PM   PM User | #4
levicki
New Coder

 
Join Date: Mar 2009
Posts: 18
Thanks: 3
Thanked 2 Times in 2 Posts
levicki is on a distinguished road
Cool

Quote:
Originally Posted by Kor View Post
There is no automate conversion in web development. You should create the elements (divs) and you should create your CSS classes by hand, writing the code lines.
Jesus Christ... I thought we are in the 21st century... yet we still do such things by hand. I was afraid of such answer.

@VIPStephan:
That is probably what I will have to do but this crap design has meticulously nested tables, and inner part has the content so it is hard to replace only the parts around it.

Basically, I will need to reverse-engineer the whole layout (even site menu is done with a table).

Unrelated question:

I want to redesign my personal website. Can you suggest the best way of making scalable website layout which is accessible on HD monitors as well as on smartphones? Are CSS media types still considered the best approach?
levicki is offline   Reply With Quote
Old 11-23-2011, 12:32 PM   PM User | #5
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Quote:
Originally Posted by levicki View Post
Jesus Christ... I thought we are in the 21st century... yet we still do such things by hand. I was afraid of such answer.
You can't automatize everything on this world. Nor should be possible
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 11-23-2011, 01:32 PM   PM User | #6
moon-safari
New Coder

 
Join Date: Oct 2011
Posts: 27
Thanks: 0
Thanked 2 Times in 2 Posts
moon-safari is an unknown quantity at this point
Are you looking for something like this?

(pseude code)
Code:
for each (row)
{
  <div class="row" style="height:cell-height">
  for each (cell)
  {
     <div class="cell" style="width:cell-width/total-width+"%""> (..here Content of current Cell..) </div>
  }
  </div>
}

<!-- style -->
.row {position:relative;width:100%;}
.cell {position:relative;float:left;height:100%;}
Of cause, this would only work if you have a really simple table layout with no rowspan. I'm not 100% sure, but i think with a little effort it would be possible to automate this transformation even for more complex layouts. You could use for example XSL transformations to achieve what you want.
But if you just have to rewrite a few documents, then it might be really faster to edit them by hand than to write yourself a transformation algorithm.
moon-safari is offline   Reply With Quote
Old 11-23-2011, 02:59 PM   PM User | #7
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,585
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by levicki View Post
Are CSS media types still considered the best approach?
Only in limited ways since smartphones usually consider themselves as “screen” media, too. However, CSS 3 has introduced media queries which allow for responsive websites.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Users who have thanked VIPStephan for this post:
levicki (11-24-2011)
Old 11-24-2011, 12:20 AM   PM User | #8
levicki
New Coder

 
Join Date: Mar 2009
Posts: 18
Thanks: 3
Thanked 2 Times in 2 Posts
levicki is on a distinguished road
Cool

Quote:
Originally Posted by VIPStephan View Post
Only in limited ways since smartphones usually consider themselves as “screen” media, too. However, CSS 3 has introduced media queries which allow for responsive websites.
I read both articles, excellent info, thanks

I shall try that soon...
levicki is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:18 AM.


Advertisement
Log in to turn off these ads.