473,387 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,387 software developers and data experts.

Non scrolling header in table

Hi,
I've made a TABLE inside a DIV element.

The DIV is set to have { height: 60px; overflow: auto; } so that the
TABLE can be scrolled using the vertical scroll bar.

This is a very nice effect, but I also would like that the first row,
the one with the TD elements, would not scroll.

I really don't know if and how it is possible to achive this.

You can see a demo page at:

http://www.ribesinformatica.it/demo/table.html

Any help is really appreciated. Thanks.

Bye,

Andrea.
Jul 20 '05 #1
6 17142
Andrea Musuruane wrote:
I've made a TABLE inside a DIV element.

The DIV is set to have { height: 60px; overflow: auto; } so that the
TABLE can be scrolled using the vertical scroll bar.

This is a very nice effect, but I also would like that the first row,
the one with the TD elements, would not scroll.


Try splitting the table into thead, tbody, and tfoot (if necessary).
Then use the styles on the tbody. Note that I did not test this.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #2
On Mon, 20 Oct 2003 14:20:47 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:

Try splitting the table into thead, tbody, and tfoot (if necessary).
Then use the styles on the tbody. Note that I did not test this.


Thank you Brian, but what property should I use not to scroll the
thead?

Bye,

Andrea.
Jul 20 '05 #3
"Andrea Musuruane" <no@spam.it> wrote in message
news:bn**********@newsreader.mailgate.org...
On Mon, 20 Oct 2003 14:20:47 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:

Try splitting the table into thead, tbody, and tfoot (if necessary).
Then use the styles on the tbody. Note that I did not test this.


Thank you Brian, but what property should I use not to scroll the
thead?


None. See the spec for more details on THEAD.
http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3

Note that you should *not* be using the styles on the div if you are going
to use this approach. If you do, you probably wont get the results you want
from THEAD because you will be scrolling the div instead.

Regards,
Peter Foti
Jul 20 '05 #4
Andrea Musuruane wrote:
On Mon, 20 Oct 2003 14:20:47 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:

Try splitting the table into thead, tbody, and tfoot (if necessary).
Then use the styles on the tbody. Note that I did not test this.

Thank you Brian, but what property should I use not to scroll the
thead?


Hmm. I don't know, because you snipped so much of the message! (And
so often people don't snip enough.)

I just checked the original message. You have div with fixed height
and overflow: auto. (BTW, if the table contains text, you should
really set height in em or ex units, and not pixels.) I've never
tried something like this, and I don't have time to test it myself,
but it sounds like you can play around with this a bit.

Start with sensible markup. Always. It the first row contains table
headings that you want to remain visible, start by marking them up as
<th> and not <td>. Then put them in a <thead>.

<table>
<thead>
<tr>
<th>col heading 1</th><th>col heading 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td> <!-- etc. -->
</tr>
</tbody>
<table>

Now set the height on tbody, with overflow: auto, and tell me how it
comes out. I'm curious to know. Good luck.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #5
On Mon, 20 Oct 2003 20:19:19 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:
I just checked the original message. You have div with fixed height
and overflow: auto. (BTW, if the table contains text, you should
really set height in em or ex units, and not pixels.) I've never
tried something like this, and I don't have time to test it myself,
but it sounds like you can play around with this a bit. Now set the height on tbody, with overflow: auto, and tell me how it
comes out. I'm curious to know. Good luck.


I applied your suggestion. You can have a look here:

http://www.ribesinformatica.it/demo/table2.html

With Opera 7.20, IE 5.5 and IE 6.0 the TBODY doesn't scroll and the
table looks like a normal, non-formatted, table. With IE the height
specified for the TBODY is appied (erroneously, I think) to each TR.

With Mozilla 1.4.1, the TBODY scrolls, but cell borders don't.

My fear is that CSS support of non-Mozilla browsers is not to poor to
achive this effect :-(

BTW I used the W3C validators and the HTML page and the CSS are valid.

Bye,

Andrea.
Jul 20 '05 #6
Andrea Musuruane wrote:
On Mon, 20 Oct 2003 20:19:19 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:

I just checked the original message. You have div with fixed height
and overflow: auto. (BTW, if the table contains text, you should
really set height in em or ex units, and not pixels.) I've never
tried something like this, and I don't have time to test it myself,
but it sounds like you can play around with this a bit.


Now set the height on tbody, with overflow: auto, and tell me how it
comes out. I'm curious to know. Good luck.

I applied your suggestion. You can have a look here:

http://www.ribesinformatica.it/demo/table2.html

With Opera 7.20, IE 5.5 and IE 6.0 the TBODY doesn't scroll and the
table looks like a normal, non-formatted, table. With IE the height
specified for the TBODY is appied (erroneously, I think) to each TR.

With Mozilla 1.4.1, the TBODY scrolls, but cell borders don't.

My fear is that CSS support of non-Mozilla browsers is not to poor to
achive this effect :-(

BTW I used the W3C validators and the HTML page and the CSS are valid.

Bye,

Andrea.

Darn, I was hoping you could do it.
When I needed to do this I used (shudder) frames. Works fine but is a pain.

Jul 20 '05 #7

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

Similar topics

9
by: johkar | last post by:
I only have IE 6 and dial-up. Can you help me determine which browsers support this code? Thanks, John <html> <head> <title>Fixed Table Headers</title> <script language="JavaScript"...
2
by: Big Slim | last post by:
I'm trying to use the OVERFLOW property to make only part of a table scrollable, but to no avail. You can split a table into two tables, with your column headers in the top table and your data...
7
by: Skip Hollowell | last post by:
I have what is now a table with a header row and then obviously rows of data beneath. If the data is more than 50 or 6 rows (100px) then the rows will scroll using overflow:auto. This all works...
3
by: SmartBloke | last post by:
What I want to be able to do is to present a table (with 3 varying width columns) as a scrolling list of items. I can do this by placing the table within a div which has overflow-y set to scroll -...
44
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
7
by: Shawn B. | last post by:
Greetings, I am trying to create a table that has a scrolling body. The problem I'm experiencing is that if the columns in the "body" part of the table exceed the width of the "header" then...
12
by: Jon Paal | last post by:
trying to use this script for scrolling tables found at this link: http://www.litotes.demon.co.uk/example_scripts/tableScroll.html The top left corner in the table grid is hidden from being...
2
by: dfdavis.mtu | last post by:
I have a table that I dynamically fill with data from a database for medical companies to be able to determine if their patients meet certain criteria. However they want a fixed header for it so...
3
by: Jimmy B | last post by:
Hello folks, Does anyone of you know any Open Source GridView Extension that has vertical Scrollbar and fixed Header? Tried to Google but didn't find any proper (because of Css). It should...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.