Advanced Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignAdvanced Web Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 6th, 2005, 07:46 AM
Stormd Stormd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 Stormd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 36 sec
Reputation Power: 0
Scrollbars

I need to know if one can add scrollbars to tables.

If so, can you give an example code for how to do that...

If not, can you supply a good learning frames tutorial?


Thanks.

Reply With Quote
  #2  
Old May 6th, 2005, 08:54 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
The following doesn't seem to work in IE...
But try it in Firefox...

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Table Test</title>
<style type="text/css">

body {
font-family: sans-serif;
}

table {
border-color: #000000;
border-spacing: 0px;
border-style: solid;
border-width: 2px;
cell-spacing: 0px;
margin-left: auto;
margin-right: auto;
}

tbody.scrolling {
overflow: auto;
}

td, th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
}

td.numeric {
text-align: right;
}

th.numeric {
text-align: right;
}

tr.alt {
background-color: #c0f0c0;
}

</style>
</head>
<body>

<table cellpadding="0" cellspacing="0">
<thead>
<tr style="background-color:#008000;color:#ffffff;">
<th>Number</th>
<th>Date</th>
<th>Description</th>
<th>Amount</th>
<th>Tax</th>
<th>Balance</th>
</tr>
<tr style="background-color:#90c090;color:#000000;">
<th colspan=5 style="text-align:right;">Starting Balance</th>
<th class="numeric">$5153.89&nbsp;&nbsp;&nbsp;&nbsp;</th>
</tr>
</thead>
<tfoot>
<tr style="background-color:#90c090;color:#000000;">
<th colspan=5 style="text-align:right;">Ending Balance</th>
<th class="numeric">$5881.95&nbsp;&nbsp;&nbsp;&nbsp;</th>
</tr>
</tfoot>
<tbody class="scrolling" style="max-height:14ex;">
<tr>
<td class="numeric">C1487</td>
<td class="numeric">04/05/00</td>
<td>Benton Bakery</td>
<td class="numeric">-$32.14</td>
<td>&nbsp;</td>
<td class="numeric">$5121.75&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr class="alt">
<td class="numeric">C1488</td>
<td class="numeric">04/05/00</td>
<td>Dave's Dry Cleaning</td>
<td class="numeric">-$14.21</td>
<td>&nbsp;</td>
<td class="numeric">$5107.54&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td class="numeric">&nbsp;</td>
<td class="numeric">04/07/00</td>
<td>Deposit</td>
<td class="numeric">$1231.57</td>
<td>&nbsp;</td>
<td class="numeric">$6339.11&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr class="alt">
<td class="numeric">DC102341</td>
<td class="numeric">04/07/00</td>
<td>Murray's</td>
<td class="numeric">-$54.31</td>
<td>Y</td>
<td class="numeric">$6284.80&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td class="numeric">C1488</td>
<td class="numeric">04/08/00</td>
<td>Greatland Auto Insurance</td>
<td class="numeric">-$119.52</td>
<td>&nbsp;</td>
<td class="numeric">$6165.28&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr class="alt">
<td class="numeric">C1489</td>
<td class="numeric">04/08/00</td>
<td>Northeast Energy</td>
<td class="numeric">-$68.21</td>
<td>&nbsp;</td>
<td class="numeric">$6097.07&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td class="numeric">DC115982</td>
<td class="numeric">04/10/00</td>
<td>Mobile</td>
<td class="numeric">-$22.19</td>
<td>Y</td>
<td class="numeric">$6074.88&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr class="alt">
<td class="numeric">C1490</td>
<td class="numeric">04/11/00</td>
<td>Consolidated Communications</td>
<td class="numeric">-$32.81</td>
<td>&nbsp;</td>
<td class="numeric">$6042.07&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td class="numeric">C1490</td>
<td class="numeric">04/12/00</td>
<td>Star Cable</td>
<td class="numeric">-$57.51</td>
<td>&nbsp;</td>
<td class="numeric">$5984.56&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr class="alt">
<td class="numeric">DC145998</td>
<td class="numeric">04/14/00</td>
<td>MegaBuy Office Supply</td>
<td class="numeric">-$102.61</td>
<td>Y</td>
<td class="numeric">$5881.95&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
</tbody>
</table>

</body>
</html>



There are similar solutions for IE
The trick is the css line overflow: auto;

Reply With Quote
  #3  
Old May 6th, 2005, 08:58 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Here's a solution that's IE compatible...
If I remember correctly, it's a little bit random.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Table Test</title>
</head>

<body>
<table style="width: 300px" cellpadding="0" cellspacing="0">
<tr>
  <td>Column 1</td>
  <td>Column 2</td>
</tr>
</table>
<div style="overflow: auto;height: 100px; width: 320px;">
  <table style="width: 300px;" cellpadding="0" cellspacing="0">
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  </table>
</div>
</body>
</html>



For the record, this example was extracted here

Reply With Quote
  #4  
Old May 6th, 2005, 03:32 PM
Stormd Stormd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 2 Stormd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 36 sec
Reputation Power: 0
Thank you for the help... but can you explain what those things do?
Because I don't really understand how it works. Sorry to trouble you again...


Reply With Quote
  #5  
Old May 6th, 2005, 04:10 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
You should notice, in the CSS for both examples is overflow: auto;.
This is the trick. Incombination with the height property, this tells the browser to keep the height, and if you need more space make them scroll.

What I like about the first example is that it is all kept within the same table. It makes use of <thead> and <tbody>... It's a shame IE doesn't support that, because it really makes the most sense.

The second example is a little harder to play with. It actually uses two tables, the second one wrapped inside a DIV. The DIV has the height and overflow set, giving it scrollbars. Sometimes the tables don't match up with the header rows though.

The best is to simply test the examples yourself.

Otherwise, you might want to use an IFRAME...
but i don't encourage iframe use.

Reply With Quote
  #6  
Old May 7th, 2005, 09:29 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 135 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 45 m 13 sec
Reputation Power: 4

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignAdvanced Web Development > Scrollbars


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT