Results 1 to 6 of 6

Thread: table layout question

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default table layout question

    I suspect this is more of a css type of question, so I am posting it here.

    I have a table of audio files with various details listed in each of the columns. At the top there is a title for each column. What I would like to do is keep the title row fixed in place so that when the user scrolls down with the mouse the row for the titles stays fixed in place.

    What do you suggest is the best way to go about this. I can think of three right now. One is to set up a table on top of another table. Second, use floats to create a similar effect and third, use some z indexing to position the table or image (I don't like the idea of using an image) to overlap the table.

    I am curious what your thoughts are. Here is a link to the page I am trying to revise.

    Also, how do you upload and display an image in a post?
    Last edited by james438; 03-06-2012 at 05:49 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Just move the first row outside the scrolling div into a div and table of its own. To get things to line up, adjust the css on the new div and on the new td's a little as shown, and you're good to go:

    Code:
    <div style='width:725px;background-color:#DFE9BF;line-height:19px;border:solid 1px #000;border-bottom-width:0;margin:auto;'>
    <table style="font-family: 'sans-serif',Helvetica, Arial, sans-serif;">
    <tr style='background-color:#EFF9CF;'>
    <td style='width:90px;'><b>Date</b></td>
    <td style='width:217px;'><b>Title</b></td>
    <td style='width:213px;'><b>Verse</b></td>
    <td style='width:205px;'><b>Preacher</b></td>
    </tr>
    </table>
    </div>
    <div style='height:375px;overflow:auto;scrollbar-base-color:tan;width:725px;background-color:#DFE9BF;line-height:19px;border:solid 1px #000;border-top-width:0;;margin:auto;'>
    <table style="font-family: 'sans-serif',Helvetica, Arial, sans-serif;">
    <tr class='a1hover'>
    <td style='width:90px;'><a href="http://www.sovgraceopc.org/audio/120411.mp3">2011-12-4</a></td>
    <td style='width:220px;'>A Tale of Two Annunciations</td>
    <td style='width:220px;'>Luke 1:26-38</td>
    <td style='width:195px;'>Ken Golden</td>
    </tr><tr class='a1hover'>
    <td><a href="http://www.sovgraceopc.org/audio/112711a.mp3">2011-11-27</a></td>
    <td>The Lord Remembered</td>
    <td>Luke 1:5-25</td>
    <td>Ken Golden</td>
    </tr><tr class='a1hover'>
    <td><a href="http://www.sovgraceopc.org/a . . .
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    james438 (03-06-2012)

  4. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Thank you, that was definitely what I was looking for. I noticed the other parts where you refined my css a little as well.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I collapsed the borders in the tables and notice that in different browsers the columns don't always line up very well. Do you (or others) have any suggestions on how to get things to line up again?
    To choose the lesser of two evils is still to choose evil. My personal site

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Using Firefox or Chrome as the standard, line them up in it. Then the only browsers you should need to tweak are IE 8 or possibly less and maybe Opera. IE 9 should follow Chrome/Firefox/Safari. IE 8 and/or less can have conditional stylesheets made. Opera would need a javascript assist if it needs it's own styles.

    In my tests without collapsed borders, IE 9 and 8/Chrome/Firefox/Safari were close enough together not to worry about.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    james438 (03-06-2012)

  8. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Ah, much obliged. Thank you .

    I code a little less these days and sometimes the obvious answers are not as obvious as they once were.
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •