473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

table formatting

Hi All,

I have a nice easy table and/or CSS formatting problem for any gurus out
there.

I have a table with 4 columns - no "width" attribute on anything.

Some rows have 4 cells in (call these type A) and some have colspan=4 (type
B)

Some type B rows have much more text than all the type A cells put together.
When this happens, the total width of the table expands (which is good) but
it expands all the 4 columns evenly and this makes the type A rows look
wrong. I would like to have the 4th column (or possibly an extra 5th column)
take up all the slack so that the type A rows have their width the same as
if the type B row only had a short value in it.

Any ideas? - I've tried putting in a 5th column with width=100% but this
causes the first 4 columns to break into multiple lines whenever there is a
space.

Jul 21 '05 #1
20 3013
Andy Fish wrote:
Hi All,

I have a nice easy table and/or CSS formatting problem for any gurus out
there.

I have a table with 4 columns - no "width" attribute on anything.

Some rows have 4 cells in (call these type A) and some have colspan=4 (type
B)

Some type B rows have much more text than all the type A cells put together.
When this happens, the total width of the table expands (which is good) but
it expands all the 4 columns evenly and this makes the type A rows look
wrong. I would like to have the 4th column (or possibly an extra 5th column)
take up all the slack so that the type A rows have their width the same as
if the type B row only had a short value in it.

Any ideas? - I've tried putting in a 5th column with width=100% but this
causes the first 4 columns to break into multiple lines whenever there is a
space.


try css-tables

<style type="text/css">
..wrapper {
float: left;
border: 1px solid black;
}

..cell {
float: left;
clear: right;
border: 1px solid red;
}

..cell_right_fill {
display: block;
border: 1px solid green;
}

..break {
clear: both;
}
</style>
<div class=wrapper>
<div class=cell>blabla</div>
<div class=cell>blabla</div>
<div class=cell>blabla</div>
<div class=cell>blabla bla</div>
<div class=break></div>

<div class=cell_right_fill>blablablabla
blablablablablablablablablablablablablabla</div>
</div>
Jul 21 '05 #2

"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...


try css-tables


Thanks for the reply. Unfortunately this doesn't give me the table
formatting that I need.

for the A rows, I need them to line up down the page. otherwise I could just
have had a separate table for each row

Andy

Jul 21 '05 #3
Els
Andy Fish wrote:
I have a table with 4 columns - no "width" attribute on
anything.

Some rows have 4 cells in (call these type A) and some have
colspan=4 (type B)

Some type B rows have much more text than all the type A
cells put together. When this happens, the total width of
the table expands (which is good) but it expands all the 4
columns evenly and this makes the type A rows look wrong. I
would like to have the 4th column (or possibly an extra 5th
column) take up all the slack so that the type A rows have
their width the same as if the type B row only had a short
value in it.

Any ideas? - I've tried putting in a 5th column with
width=100% but this causes the first 4 columns to break
into multiple lines whenever there is a space.


Why not putting in a 5th column without a width, and setting the
desired width to the first 4?

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Madness - On The Beat Pete
Jul 21 '05 #4
Andy Fish wrote:
"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...
try css-tables

Thanks for the reply. Unfortunately this doesn't give me the table
formatting that I need.

for the A rows, I need them to line up down the page. otherwise I could just
have had a separate table for each row

Andy


very helpful when you come now with extra information, a good example
why you better be complete when you post a problem.
Jul 21 '05 #5

"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...
Andy Fish wrote:
"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...
try css-tables

Thanks for the reply. Unfortunately this doesn't give me the table
formatting that I need.

for the A rows, I need them to line up down the page. otherwise I could
just have had a separate table for each row

Andy


very helpful when you come now with extra information, a good example why
you better be complete when you post a problem.


ok, sorry I thought it was clear. here's an example

<table border=1>
<tr><td><b>author</b></td><td><b>isbn</b></td><td><b>title</b></td></tr>
<tr><td>john smith</td><td>5343</td><td>a book</td></tr>
<tr><td>joe shmoe</td><td>473</td><td>a book about fish</td></tr>
<tr><td>frank schweizz</td><td>483</td><td>a cookery book</td></tr>
<tr><td colspan="3">now this is a book I really like. you should definitely
buy this one if you like cooking because it has lots of good
recipies</td></tr>
<tr><td>art davidson</td><td>483</td><td>a DIY book</td></tr>
</table>

I don't want the long line to stretch the table (it should appear to go
beyond it) but I need the columns in the different rows to line up properly.

In the real thing I won't have borders - they're just there to illustrate
the problem.

Andy


Jul 21 '05 #6

"Els" <el*********@tiscali.nl> wrote in message
news:Xn*****************@130.133.1.4...
Andy Fish wrote:
I have a table with 4 columns - no "width" attribute on
anything.

Some rows have 4 cells in (call these type A) and some have
colspan=4 (type B)

Some type B rows have much more text than all the type A
cells put together. When this happens, the total width of
the table expands (which is good) but it expands all the 4
columns evenly and this makes the type A rows look wrong. I
would like to have the 4th column (or possibly an extra 5th
column) take up all the slack so that the type A rows have
their width the same as if the type B row only had a short
value in it.

Any ideas? - I've tried putting in a 5th column with
width=100% but this causes the first 4 columns to break
into multiple lines whenever there is a space.
Why not putting in a 5th column without a width, and setting the
desired width to the first 4?


I don't want to have a fixed width for the other columns - they need to be
automatically sized to fit the contents. The nearest I have come so far is
putting "nowrap" on the first 4 columns and then the 5th column = 100% but I
don't really want nowrap.

it seems to me that this is something missing from HTML and CSS. I would
like to specify a table column that soaks up any extra whitespace.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Madness - On The Beat Pete

Jul 21 '05 #7
On Sun, 06 Feb 2005 14:06:36 GMT Andy Fish wrote:
Hi All, I have a nice easy table and/or CSS formatting problem for any gurus
out
there. I have a table with 4 columns - no "width" attribute on anything. Some rows have 4 cells in (call these type A) and some have colspan=4
(type
B) Some type B rows have much more text than all the type A cells put
together.
When this happens, the total width of the table expands (which is good)
but
it expands all the 4 columns evenly and this makes the type A rows look
wrong. I would like to have the 4th column (or possibly an extra 5th
column)
take up all the slack so that the type A rows have their width the same
as
if the type B row only had a short value in it. Any ideas? - I've tried putting in a 5th column with width=100% but
this
causes the first 4 columns to break into multiple lines whenever there
is a
space.


According to information given so far, try this in CSS:

<style>
..contain {height:300px; width:300px;}

..leftcol { width:100px; height:300px; border:2px solid red; float:left; }
..row1, .row2, .row3, .row4 { width 190px; height:70px; border:2px solid
blue; }
</style>
<body>
<div class="contain">
<div class="leftcol">Sample text</div>
<div class="row1">Famous last words</div>
<div class="row2">Famous first words</div>
<div class="row3">Rich and Famous</div>
<div class="row4">Nobody special</div>
</div>
</body>
Jul 21 '05 #8
Andy Fish wrote:
"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...
Andy Fish wrote:

"Ali Babba" <Al******@40Bandits.com> wrote in message
news:cu**********@news.hispeed.ch...
try css-tables

Thanks for the reply. Unfortunately this doesn't give me the table
formatting that I need.

for the A rows, I need them to line up down the page. otherwise I could
just have had a separate table for each row

Andy


very helpful when you come now with extra information, a good example why
you better be complete when you post a problem.

ok, sorry I thought it was clear. here's an example

<table border=1>
<tr><td><b>author</b></td><td><b>isbn</b></td><td><b>title</b></td></tr>
<tr><td>john smith</td><td>5343</td><td>a book</td></tr>
<tr><td>joe shmoe</td><td>473</td><td>a book about fish</td></tr>
<tr><td>frank schweizz</td><td>483</td><td>a cookery book</td></tr>
<tr><td colspan="3">now this is a book I really like. you should definitely
buy this one if you like cooking because it has lots of good
recipies</td></tr>
<tr><td>art davidson</td><td>483</td><td>a DIY book</td></tr>
</table>

I don't want the long line to stretch the table (it should appear to go
beyond it) but I need the columns in the different rows to line up properly.

In the real thing I won't have borders - they're just there to illustrate
the problem.

Andy

why the aversion to setting the width ?
Jul 21 '05 #9

"Richard" <An*******@127.001> wrote in message
news:cu********@news4.newsguy.com...
On Sun, 06 Feb 2005 14:06:36 GMT Andy Fish wrote:
Hi All,

I have a nice easy table and/or CSS formatting problem for any gurus
out
there.

I have a table with 4 columns - no "width" attribute on anything.

Some rows have 4 cells in (call these type A) and some have colspan=4
(type
B)

Some type B rows have much more text than all the type A cells put
together.
When this happens, the total width of the table expands (which is
good)
but
it expands all the 4 columns evenly and this makes the type A rows
look
wrong. I would like to have the 4th column (or possibly an extra 5th
column)
take up all the slack so that the type A rows have their width the
same
as
if the type B row only had a short value in it.

Any ideas? - I've tried putting in a 5th column with width=100% but
this
causes the first 4 columns to break into multiple lines whenever
there
is a
space.


According to information given so far, try this in CSS:

<style>
.contain {height:300px; width:300px;}

.leftcol { width:100px; height:300px; border:2px solid red;
float:left; }
.row1, .row2, .row3, .row4 { width 190px; height:70px; border:2px
solid
blue; }
</style>
<body>
<div class="contain">
<div class="leftcol">Sample text</div>
<div class="row1">Famous last words</div>
<div class="row2">Famous first words</div>
<div class="row3">Rich and Famous</div>
<div class="row4">Nobody special</div>
</div>
</body>


Richard,

I do not claim be an expert in any way, shape, or form (and I'm
constantly amazed at how far above my understanding of HTML/CSS some
members of this group are); however, exactly as written, I don't think
the table example you've given works too well in Firefox. IE6 is just
OK. In my quest for the "perfect" table substitute, this seems to be
common. What works for IE breaks in FF--or vice-versa. Cheers!

Del Ferguson
Jul 21 '05 #10
>>

why the aversion to setting the width ?


simply that I want the user to be able to resize the page to be however wide
they like.

Jul 21 '05 #11
On Sun, 6 Feb 2005 10:19:12 -0800 Del Ferguson wrote:

Richard, I do not claim be an expert in any way, shape, or form (and I'm
constantly amazed at how far above my understanding of HTML/CSS some
members of this group are); however, exactly as written, I don't think
the table example you've given works too well in Firefox. IE6 is just
OK. In my quest for the "perfect" table substitute, this seems to be
common. What works for IE breaks in FF--or vice-versa. Cheers! Del Ferguson

The reason it "breaks" in firefox, is because firefox does it right.
Going to find out why, I found a couple of typos and added a float:left and
it works as intended.
IE has a kind of built in "I will assume they mean to do it this way" thing.
Which is fine, but then how is one to learn proper coding if the coder
relies on the browser to correct his mistakes?
Jul 21 '05 #12
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andy Fish wrote:
| Hi All,
|
| I have a nice easy table and/or CSS formatting problem for any gurus out
| there.
|
| I have a table with 4 columns - no "width" attribute on anything.
|
| Some rows have 4 cells in (call these type A) and some have colspan=4 (type
| B)
|
~ Use multiple tables instead of one. Whenever you get to one of the
colspan=4 roes, end the table, use a div to display the text, then begin
the next table.

- --
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (OS/2)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCBrF7zTcr8Prq0ZMRArmIAJ4m3D9xiCLFyfaYbfxOMU RyqdU3VQCglneV
zS0Pcuvc4H6udx/GZ0p/epI=
=r1ew
-----END PGP SIGNATURE-----
Jul 21 '05 #13
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andy Fish wrote:
|>>
|>why the aversion to setting the width ?
|
| simply that I want the user to be able to resize the page to be however
wide
| they like.
|
~ Use percentages.

- --
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (OS/2)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCBwG7zTcr8Prq0ZMRArf1AKCpzgalsuhU/r0C1jA9oIQGiqRTHACeKa6k
SpZr02DDeyGAcghmPeUgJoM=
=Qh7e
-----END PGP SIGNATURE-----
Jul 21 '05 #14
Ali Babba wrote:
Andy Fish wrote:
"Ali Babba" wrote...
try css-tables

Thanks for the reply. Unfortunately this doesn't give me the table
formatting that I need.

for the A rows, I need them to line up down the page. otherwise I
could just have had a separate table for each row


very helpful when you come now with extra information,


The op said he had a table. A table generally means that rows and
columns must line up to make sense of the data. Unless the table does
not contain tabular data, that is not "extra information", but what
was in the op.
a good example why you better be complete when you post a problem.


A url would have been even better.

--
Brian
Jul 21 '05 #15
Richard wrote:
According to information given so far, try this in CSS:

<style>
.contain {height:300px; width:300px;}

.leftcol { width:100px; height:300px; border:2px solid red; float:left; }
.row1, .row2, .row3, .row4 { width 190px; height:70px; border:2px solid
blue; }
</style>


That's a brittle solution that will fail when a user chooses an
unexpectedly large font size.

--
Brian
Jul 21 '05 #16
Andy Fish wrote:
I have a nice easy table and/or CSS formatting problem for any gurus
out there.
We need a url to provide meaningful help.
I have a table with 4 columns - no "width" attribute on anything.

Some rows have 4 cells in (call these type A) and some have colspan=4
(type B)

Some type B rows have much more text than all the type A cells put
together. When this happens, the total width of the table expands
(which is good) but it expands all the 4 columns evenly and this
makes the type A rows look wrong. I would like to have the 4th column
(or possibly an extra 5th column) take up all the slack so that the
type A rows have their width the same as if the type B row only had a
short value in it.
Set the width of the first 3 columns in em units. It will resize for the
user, but keep those rows at the same width regardless of the width of
the 1-column rows.
I've tried putting in a 5th column with width=100%


A 5th column? Are you sure this is tabular data?

--
Brian
Jul 21 '05 #17
Ali Babba wrote:
Andy Fish wrote:
I have a table with 4 columns - no "width" attribute on anything.
[snip] the type A rows look wrong. I would like to have the 4th
column (or possibly an extra 5th column) take up all the slack so
that the type A rows have their width the same as if the type B row
only had a short value in it.
try css-tables


That's only useful if table markup is wrong. Otherwise, css-tables are
the wrong markup approach. And the markup is what counts, especially
since CSS is optional.
<style type="text/css">
.wrapper {
float: left;
border: 1px solid black;
}

.cell {
float: left;
clear: right;
border: 1px solid red;
}

.cell_right_fill {
display: block;
border: 1px solid green;
}

.break {
clear: both;
}
</style>


None of this constitutes css tables. Instead, you've used display: block
and floats. That may be a useful solution, but it is not what you
claimed it was.

--
Brian
Jul 21 '05 #18
Brian wrote:
Ali Babba wrote:
Andy Fish wrote:
I have a table with 4 columns - no "width" attribute on anything.
[snip] the type A rows look wrong. I would like to have the 4th
column (or possibly an extra 5th column) take up all the slack so
that the type A rows have their width the same as if the type B row
only had a short value in it.

try css-tables

That's only useful if table markup is wrong. Otherwise, css-tables are
the wrong markup approach. And the markup is what counts, especially
since CSS is optional.
<style type="text/css">
.wrapper {
float: left;
border: 1px solid black;
}

.cell {
float: left;
clear: right;
border: 1px solid red;
}

.cell_right_fill {
display: block;
border: 1px solid green;
}

.break {
clear: both;
}
</style>

None of this constitutes css tables. Instead, you've used display: block
and floats. That may be a useful solution, but it is not what you
claimed it was.

could you back up your claim with a reference to an undisputable
definition of 'css-tables' ?
Jul 21 '05 #19
in comp.infosystems.www.authoring.html, Ali Babba wrote:
Brian wrote:
None of this constitutes css tables. Instead, you've used display: block
and floats. That may be a useful solution, but it is not what you
claimed it was.

could you back up your claim with a reference to an undisputable
definition of 'css-tables' ?


http://www.w3.org/TR/REC-CSS2/tables.html

especially http://www.w3.org/TR/REC-CSS2/tables.html#q2

Which you would have wound esily using google

http://www.google.com/search?&q=css-tables

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 21 '05 #20
Ali Babba wrote:
Brian wrote:
Ali Babba wrote:
[excessive quoting snipped]
<style type="text/css">
.wrapper {
float: left;
border: 1px solid black;
}

.cell {
float: left;
clear: right;
border: 1px solid red;
}

.cell_right_fill {
display: block;
border: 1px solid green;
}

.break {
clear: both;
}
</style>

None of this constitutes css tables.


could you back up your claim with a reference to an undisputable
definition of 'css-tables' ?


http://www.w3.org/TR/CSS21/tables.html

Your sense of outrage is charming, especially since you're so
uncontroversially wrong.

--
Brian
Jul 21 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
Greetings. I am having some difficulty with formatting a table on a web form and hope someone can help. Currently the table has a single column. Desired output format (X = text , X = number) ...
6
by: Kevin G. | last post by:
I'm not sure if this is possible, but if a page uses a CSS style sheet and you would still like to use good old <font> tags... is there a tag to tell the browser to ignore the CSS formatting just...
4
by: deko | last post by:
I've heard it's best not to have any formatting specified for Table fields (except perhaps Currency), and instead set the formatting in the Form or Report. But what about Yes/No fields? When I...
4
by: Dave Brydon | last post by:
Access 2003 I have a combo box in my personnel table, which draws its data from a trade code table; the original field in the code table, is numeric, Long Integer, and formatted with 5 zero's . ...
2
by: Leo Duran | last post by:
Hi, I am working on an app right now that makes extensive use of the DataList control. I chose the DataList because I need to do multi row formatting. I am using it like so.
10
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
2
by: Jeff | last post by:
I've been trying for days to figure out why the spacing between the rows on the left-most column of my table is screwy. Take a look here: http://mypage.iu.edu/~jbeverid/index_new.htm Right...
0
by: BrutalByte | last post by:
I have a report that I would like to apply conditonal formatting to by referencing another table's data. The "NSN" data table is a single column of NSNs. What string do I enter into the...
10
by: Greg Lovern | last post by:
I have a very large html table created by MS Word, saved as it's "Web Page, Filtered" file type. Every html table cell has lots of formatting tags. Most of the file size is that formatting. Is...
2
by: Jukka K. Korpela | last post by:
Sub titulo "Re: DIV borders different in IE7 when in td" scripsit Ben C: This seems to be the heart of the matter, and I'm trying to get a real discussion started, by moving the discussion to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.