table formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy Fish

    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.



  • Ali Babba

    #2
    Re: table formatting

    Andy Fish wrote:[color=blue]
    > 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.
    >
    >
    >[/color]

    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_fi ll {
    display: block;
    border: 1px solid green;
    }

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


    <div class=wrapper>
    <div class=cell>blab la</div>
    <div class=cell>blab la</div>
    <div class=cell>blab la</div>
    <div class=cell>blab la bla</div>
    <div class=break></div>

    <div class=cell_righ t_fill>blablabl abla
    blablablablabla blablablablabla blablablabla</div>
    </div>

    Comment

    • Andy Fish

      #3
      Re: table formatting


      "Ali Babba" <AliBabba@40Ban dits.com> wrote in message
      news:cu5dbr$r3n $1@news.hispeed .ch...[color=blue][color=green]
      >>[/color]
      >
      > try css-tables
      >[/color]

      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



      Comment

      • Els

        #4
        Re: table formatting

        Andy Fish wrote:
        [color=blue]
        > 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.[/color]

        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

        Comment

        • Ali Babba

          #5
          Re: table formatting

          Andy Fish wrote:
          [color=blue]
          > "Ali Babba" <AliBabba@40Ban dits.com> wrote in message
          > news:cu5dbr$r3n $1@news.hispeed .ch...
          >[color=green]
          >>try css-tables
          >>[/color]
          >
          >
          > 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
          >
          >
          >[/color]

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

          Comment

          • Andy Fish

            #6
            Re: table formatting


            "Ali Babba" <AliBabba@40Ban dits.com> wrote in message
            news:cu5fdr$r3n $2@news.hispeed .ch...[color=blue]
            > Andy Fish wrote:
            >[color=green]
            >> "Ali Babba" <AliBabba@40Ban dits.com> wrote in message
            >> news:cu5dbr$r3n $1@news.hispeed .ch...
            >>[color=darkred]
            >>>try css-tables
            >>>[/color]
            >>
            >>
            >> 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
            >>
            >>
            >>[/color]
            >
            > very helpful when you come now with extra information, a good example why
            > you better be complete when you post a problem.[/color]

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

            <table border=1>
            <tr><td><b>auth or</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




            Comment

            • Andy Fish

              #7
              Re: table formatting


              "Els" <els.aNOSPAM@ti scali.nl> wrote in message
              news:Xns95F5ABE 3A4470Els@130.1 33.1.4...[color=blue]
              > Andy Fish wrote:
              >[color=green]
              >> 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.[/color]
              >
              > Why not putting in a 5th column without a width, and setting the
              > desired width to the first 4?[/color]

              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.
              [color=blue]
              >
              > --
              > Els http://locusmeus.com/
              > Sonhos vem. Sonhos vão. O resto é imperfeito.
              > - Renato Russo -
              > Now playing: Madness - On The Beat Pete[/color]


              Comment

              • Richard

                #8
                Re: table formatting

                On Sun, 06 Feb 2005 14:06:36 GMT Andy Fish wrote:
                [color=blue]
                > Hi All,[/color]
                [color=blue]
                > I have a nice easy table and/or CSS formatting problem for any gurus
                > out
                > there.[/color]
                [color=blue]
                > I have a table with 4 columns - no "width" attribute on anything.[/color]
                [color=blue]
                > Some rows have 4 cells in (call these type A) and some have colspan=4
                > (type
                > B)[/color]
                [color=blue]
                > 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.[/color]
                [color=blue]
                > 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.[/color]

                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">Fa mous last words</div>
                <div class="row2">Fa mous first words</div>
                <div class="row3">Ri ch and Famous</div>
                <div class="row4">No body special</div>
                </div>
                </body>


                Comment

                • Ali Babba

                  #9
                  Re: table formatting

                  Andy Fish wrote:
                  [color=blue]
                  > "Ali Babba" <AliBabba@40Ban dits.com> wrote in message
                  > news:cu5fdr$r3n $2@news.hispeed .ch...
                  >[color=green]
                  >>Andy Fish wrote:
                  >>
                  >>[color=darkred]
                  >>>"Ali Babba" <AliBabba@40Ban dits.com> wrote in message
                  >>>news:cu5dbr$ r3n$1@news.hisp eed.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
                  >>>
                  >>>
                  >>>[/color]
                  >>
                  >>very helpful when you come now with extra information, a good example why
                  >>you better be complete when you post a problem.[/color]
                  >
                  >
                  > ok, sorry I thought it was clear. here's an example
                  >
                  > <table border=1>
                  > <tr><td><b>auth or</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
                  >
                  >
                  >
                  >[/color]
                  why the aversion to setting the width ?

                  Comment

                  • Del Ferguson

                    #10
                    Re: table formatting


                    "Richard" <Anonymous@127. 001> wrote in message
                    news:cu5j11061t @news4.newsguy. com...[color=blue]
                    > On Sun, 06 Feb 2005 14:06:36 GMT Andy Fish wrote:
                    >[color=green]
                    >> Hi All,[/color]
                    >[color=green]
                    >> I have a nice easy table and/or CSS formatting problem for any gurus
                    >> out
                    >> there.[/color]
                    >[color=green]
                    >> I have a table with 4 columns - no "width" attribute on anything.[/color]
                    >[color=green]
                    >> Some rows have 4 cells in (call these type A) and some have colspan=4
                    >> (type
                    >> B)[/color]
                    >[color=green]
                    >> 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.[/color]
                    >[color=green]
                    >> 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.[/color]
                    >
                    > 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">Fa mous last words</div>
                    > <div class="row2">Fa mous first words</div>
                    > <div class="row3">Ri ch and Famous</div>
                    > <div class="row4">No body special</div>
                    > </div>
                    > </body>
                    >
                    >[/color]

                    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


                    Comment

                    • Andy Fish

                      #11
                      Re: table formatting

                      >>[color=blue][color=green]
                      >>[/color]
                      > why the aversion to setting the width ?[/color]

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



                      Comment

                      • Richard

                        #12
                        Re: table formatting

                        On Sun, 6 Feb 2005 10:19:12 -0800 Del Ferguson wrote:



                        [color=blue]
                        > Richard,[/color]
                        [color=blue]
                        > 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![/color]
                        [color=blue]
                        > Del Ferguson[/color]


                        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?


                        Comment

                        • Jim Moe

                          #13
                          Re: table formatting

                          -----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

                          iD8DBQFCBrF7zTc r8Prq0ZMRArmIAJ 4m3D9xiCLFyfaYb fxOMURyqdU3VQCg lneV
                          zS0Pcuvc4H6udx/GZ0p/epI=
                          =r1ew
                          -----END PGP SIGNATURE-----

                          Comment

                          • Jim Moe

                            #14
                            Re: table formatting

                            -----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

                            iD8DBQFCBwG7zTc r8Prq0ZMRArf1AK CpzgalsuhU/r0C1jA9oIQGiqRT HACeKa6k
                            SpZr02DDeyGAcgh mPeUgJoM=
                            =Qh7e
                            -----END PGP SIGNATURE-----

                            Comment

                            • Brian

                              #15
                              Re: table formatting

                              Ali Babba wrote:[color=blue]
                              > Andy Fish wrote:
                              >[color=green]
                              >> "Ali Babba" wrote...
                              >>[color=darkred]
                              >>> try css-tables[/color]
                              >>
                              >>
                              >> 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[/color]
                              >
                              > very helpful when you come now with extra information,[/color]

                              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.
                              [color=blue]
                              > a good example why you better be complete when you post a problem.[/color]

                              A url would have been even better.

                              --
                              Brian

                              Comment

                              Working...