The World’s Leading Microsoft .NET Magazine
   
 
timstall

Donate Today!

Search Box

 

Calendar

««Mar 2010»»
SMTWTFS
  12
3
456
7
8
9
10
111213
1415161718
19
20
21222324252627
28293031

My RSS Feeds








Mailing List

Most Popular Tags

                                                           

CSS Tip: Scrolling inline tables

posted Wednesday, 5 October 2005

A common UI problem is displaying a large amount of information in only a little space. Different user requirements allow for different solutions. For example, perhaps the user has 50 items, but only needs to see 10 at a time. The entire list is still small enough that you can bring all the data to the client - don't need to page through it with a previous/next button doing server hits. Technically, this could be implemented by putting all 50 items in a sub-page, and then displaying that sub-page in the main page as an inline frame. This would fulfill the user requirements:

  • You could set the frame size to be only 10 items.
  • All the data is still at the client - so it's quick
  • The user can conveniently scroll through the list.

While this functionally works, it's technically tedious. Having a separate sub-page means extra JavaScript to pass values between the main and sub page (such as when you save and you want to see the item selected). It also means one more page to keep track of. An alternative solution is to use CSS to inset the table within a div region:

  <body MS_POSITIONING="FlowLayout">
    <form id="Form1" method="post" runat="server">
      <P>This is an inline table test:</P>
      <P>
      </P>
      <table width="100%">
        <tbody>
        <tr>
          <td width="50%">
                <div style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; Z-INDEX: 1; OVERFLOW: auto; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset; HEIGHT: 100px">
        <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="1">
          <tbody>
          <TR>
            <TD>aaaaa</TD>
            <TD>bbb</TD>
          </TR>
          <TR>
            <TD>bbbbb</TD>
            <TD>bbb</TD>
          </TR>
          <TR>
            <TD>ccccc</TD>
            <TD>bbb</TD>
          </TR>
          <TR>
            <TD>ddddd</TD>
            <TD>bbb</TD>
          </TR>
          <TR>
            <TD>eeeeeeeeee</TD>
            <TD>bbb</TD>
          </TR>
          <TR>
            <TD>fffffffff</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>ggggggggg</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>hhhhhh</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>iiiiiiii</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>jjjjjjj</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>kkkkkkkkk</TD>
            <TD>bbb</TD>
          </TR>
                    <TR>
            <TD>llllllllllll</TD>
            <TD>bbb</TD>
          </TR>
        </tbody>
        </TABLE>
      </div>
          </td>
          <td>Other stuff</td>
        </tr>
      </tbody>
      </table>

      <P></P>
    </form>
  </body
>

This technique is quick to develop, has the same user benefit, and is all around cleaner.

links: digg this    technorati    




1. imran left...
Wednesday, 2 November 2005 3:48 pm :: http://www.seo-professional.co.uk

Hi

The power of CSS is amazing. I’ve seen a few sites like this one where i’ve been blown away by what you can do. Alot of DHTML and other funkiness can be avoided if your clever with your stylesheet.

I want to manage a stick up footer on the website for IE 5.0 +. with CSS As you can see 1 on bmw.co.uk

thanks

Imran