HighDots Forums  

convert a table to a <div> controlled layout

alt.html alt.html


Discuss convert a table to a <div> controlled layout in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phper
 
Posts: n/a

Default convert a table to a <div> controlled layout - 05-19-2008 , 09:39 AM






How to convert the common html table code below
<table align="center">
<tr>
<td> 1.1 &nbsp;&nbsp; </td>
<td> 1.2 &nbsp; &nbsp; </td>
<td> 1.3 &nbsp;&nbsp;
</td>
</tr>
<tr>
<td> 2.1 &nbsp;&nbsp; </td>
<td> 2.2 &nbsp; &nbsp; </td>
<td> 2.3 &nbsp; &nbsp; </td>
</tr>
<tr>
<td> 3.1 &nbsp;&nbsp; </td>
<td> 3.2 &nbsp; &nbsp; </td>
<td> 3.3 &nbsp; &nbsp; </td>
</tr>

</table>

to a <div> controlled layout using css?

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 09:57 AM






Scripsit Phper:

Quote:
How to convert the common html table code below
- -
to a <div> controlled layout using css?
Is this an exercise on a course? You're then supposed to do it yourself
to learn things. If you can't, your instructor should explain the
solution after you've tried hard.

It looks very much like an exercise, since no URL was given and the data
does not contain realistic data. It actually looks much like a tabular
data structure, so it would be a _poor_ exercise. In that case, the best
answer - though perhaps not the one that will be _judged_ best - would
explain both why it is wrong to do such a conversion and why it will
fail due to lack of browser support to the adequate way of creating real
and flexible tabulation in CSS.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
richard
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 11:41 AM



On Mon, 19 May 2008 06:39:30 -0700 (PDT), Phper
<hi.steven.tu (AT) gmail (DOT) com> wrote:

Quote:
How to convert the common html table code below
table align="center"
tr
td> 1.1 &nbsp;&nbsp; </td
td> 1.2 &nbsp; &nbsp; </td
td> 1.3 &nbsp;&nbsp;
/td
/tr
tr
td> 2.1 &nbsp;&nbsp; </td
td> 2.2 &nbsp; &nbsp; </td
td> 2.3 &nbsp; &nbsp; </td
/tr
tr
td> 3.1 &nbsp;&nbsp; </td
td> 3.2 &nbsp; &nbsp; </td
td> 3.3 &nbsp; &nbsp; </td
/tr

/table

to a <div> controlled layout using css?

Simple. Each table cell equals a division.
So instead of seeing <table><tr><td>abc</td></tr></table>
you would see <div>abc</div>.

Give each cell a class name and use css to define it's
characteristics. For this excercise you will need to learn about
"float", "margin" and "padding".

IMHO, use of &nbsp sucks. I'd prefer to define a width of the cell,
then center the contents. Or if I wanted to align them to the left or
right, use padding.


Reply With Quote
  #4  
Old   
richard
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 12:39 PM



On Mon, 19 May 2008 06:39:30 -0700 (PDT), Phper
<hi.steven.tu (AT) gmail (DOT) com> wrote:

Quote:
How to convert the common html table code below
table align="center"
tr
td> 1.1 &nbsp;&nbsp; </td
td> 1.2 &nbsp; &nbsp; </td
td> 1.3 &nbsp;&nbsp;
/td
/tr
tr
td> 2.1 &nbsp;&nbsp; </td
td> 2.2 &nbsp; &nbsp; </td
td> 2.3 &nbsp; &nbsp; </td
/tr
tr
td> 3.1 &nbsp;&nbsp; </td
td> 3.2 &nbsp; &nbsp; </td
td> 3.3 &nbsp; &nbsp; </td
/tr

/table

to a <div> controlled layout using css?

Just for kicks I converted your table to divisions here
http://1littleworld.com/table101.html
purely as an attempt to show you one possible way of doing it.



Reply With Quote
  #5  
Old   
Travis Newbury
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 01:56 PM



On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Quote:
Just for kicks I converted your table to divisions herehttp://1littleworld.com/table101.html
purely as an attempt to show you one possible way of doing it.
While I do not disagree with your advice (or Jukka's), Just for kicks
I wanted to see how much more work it was to make the div version....

Just the code to make thge table or the divs:
166 keystrokes for the table version
372 for the div version. (687 if you count the style, but that would
be an unfair comparison as the table has no style...)

Hey, don't read anything into this, I just had some free time on my
hands....


Reply With Quote
  #6  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 03:27 PM



Scripsit Travis Newbury:

Quote:
On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Just for kicks I converted your table to divisions
herehttp://1littleworld.com/table101.html purely as an attempt to
show you one possible way of doing it.

While I do not disagree with your advice
You should.

Quote:
(or Jukka's),
I agree with your refusal to disagree with my advice, because it was
correct.

Quote:
Just for kicks
I wanted to see how much more work it was to make the div version....
I hope you enjoyed it, but it's really not relevant. The relevant thing
is that you can't turn <div> soup into something that is "the same" as a
simple HTML table. You could simulate it by using _fixed-width_ <div>s,
but this would destroy much of the table idea.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #7  
Old   
richard
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 03:28 PM



On Mon, 19 May 2008 10:56:04 -0700 (PDT), Travis Newbury
<TravisNewbury (AT) hotmail (DOT) com> wrote:

Quote:
On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Just for kicks I converted your table to divisions herehttp://1littleworld.com/table101.html
purely as an attempt to show you one possible way of doing it.

While I do not disagree with your advice (or Jukka's), Just for kicks
I wanted to see how much more work it was to make the div version....

Just the code to make thge table or the divs:
166 keystrokes for the table version
372 for the div version. (687 if you count the style, but that would
be an unfair comparison as the table has no style...)

Hey, don't read anything into this, I just had some free time on my
hands....

ahhh geee thanks man. I needed that.


Reply With Quote
  #8  
Old   
richard
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 04:38 PM



On Mon, 19 May 2008 22:27:43 +0300, "Jukka K. Korpela"
<jkorpela (AT) cs (DOT) tut.fi> wrote:

Quote:
Scripsit Travis Newbury:

On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Just for kicks I converted your table to divisions
herehttp://1littleworld.com/table101.html purely as an attempt to
show you one possible way of doing it.

While I do not disagree with your advice

You should.

(or Jukka's),

I agree with your refusal to disagree with my advice, because it was
correct.

Just for kicks
I wanted to see how much more work it was to make the div version....

I hope you enjoyed it, but it's really not relevant. The relevant thing
is that you can't turn <div> soup into something that is "the same" as a
simple HTML table. You could simulate it by using _fixed-width_ <div>s,
but this would destroy much of the table idea.

Do note, I said this was only one possiblity.
The excercise was what one needs to do to make it work.
Not that it was 100% correct by any means.


Reply With Quote
  #9  
Old   
dorayme
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 05:59 PM



In article
<13131dd7-7f52-493a-bf92-189464ed5eb6 (AT) y38g2000hsy (DOT) googlegroups.com>,
Travis Newbury <TravisNewbury (AT) hotmail (DOT) com> wrote:

Quote:
On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Just for kicks I converted your table to divisions
herehttp://1littleworld.com/table101.html
purely as an attempt to show you one possible way of doing it.

While I do not disagree with your advice (or Jukka's), Just for kicks
I wanted to see how much more work it was to make the div version....

Just the code to make thge table or the divs:
166 keystrokes for the table version
372 for the div version. (687 if you count the style, but that would
be an unfair comparison as the table has no style...)
It would not be an unfair comparison for the following reason:

Now and then, you just might have heard me talking about the magic of
tables. This is me saying tables do a lot of things for the author. The
technology comes to the party offering a great deal of cleverness. The
cleverness is built into it.

Much of the visual formatting is automatically contributed by the most
elementary use of the table. The author need not even concern himself
with widths or heights. His only absolutely essential job is to enter
related information into rows and columns. The widths and heights and
regular horizontal and vertical patterning and fluid behaviour on a
webpage will follow automatically.

In other words, to put it crudely, there is a lot of "looks" that are
contributed by tables rather than by the strenuous efforts of authors.
Put another way, authors do not have to be such control freaks with
tables as they do with other ways of presenting tabular data. And no
wonder. Tables were designed in the first place to handle such data.

To try to mimic this magic or inbuilt fluidity using other methods not
made for the purpose is obviously going to require more effort. So, you
are not wrong and your comparison is not unfair.

I suppose I better add that this is a defence of you. And that it has
nothing at all to do with tables as mere layout.

Quote:
Hey, don't read anything into this, I just had some free time on my
hands....
--
dorayme


Reply With Quote
  #10  
Old   
dorayme
 
Posts: n/a

Default Re: convert a table to a <div> controlled layout - 05-19-2008 , 06:02 PM



In article <twkYj.3490$_03.1159 (AT) reader1 (DOT) news.saunalahti.fi>,
"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote:

Quote:
Scripsit Travis Newbury:

On May 19, 12:39 pm, richard <mem... (AT) newsguy (DOT) com> wrote:

Just for kicks I converted your table to divisions
herehttp://1littleworld.com/table101.html purely as an attempt to
show you one possible way of doing it.

....

Quote:
I hope you enjoyed it, but it's really not relevant. The relevant thing
is that you can't turn <div> soup into something that is "the same" as a
simple HTML table. You could simulate it by using _fixed-width_ <div>s,
but this would destroy much of the table idea.
Absolutely typical misunderstanding of what a fellow human is saying!

--
dorayme


Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.