Table with scrollbar?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Table with scrollbar?

Post by WithHisStripes »

Heya,
I know this doesn't directly apply to PHP but I can't find anyone who knows how to do this: I need to create a table with a scrollbar, please tell me one of you know! Thanks

-Spence
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Put the table in a div tag and set the CSS of the div tag to overflow: scroll;
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Post by WithHisStripes »

Thanks for the reply bud, but that didn't seem to work, it puts scrolls on the left hand side of the frame and I need them on the right, but as far as I can see I iserted the div tags in the right hand frame, what am I missing? You can view my files at http://www.hookweb.net/testing/table_with_scroll.zip

-Spence
thanks
Simulacra
Forum Newbie
Posts: 7
Joined: Sun Sep 11, 2005 9:25 am

Post by Simulacra »

This works in a table
<div style="height: 40em; width: 100%; overflow: auto;">
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I don't believe elements scrolling is standards compliant (correct me if I'm wrong)

you should use a div to scroll, even if it's inside the table cell

Code: Select all

<td>
  <div style="height: 100%; width: 100%; overflow: auto;">
  content
  </div>
</td>
PS: Shouldn't this be client side? :P
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

moved to client-side
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Post by WithHisStripes »

Thanks for the input but I am still either not understanding what you guys are suggesting or overlooking something. Because when I insert that code into my HTML document nothing happens. It messes up my page by adding an extra table or it does nothing at all, and there is definately no scroll bar. Could someone give me an actual example of it inside a table with content and a scroll bar instead?

-Thanks guys
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

<table width="500" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td>
			<div style="height: 300px; width: 400px; overflow: auto;">
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
				Content<BR>
			</div>
		</td>
	</tr>
</table>
http://www.showmypro.com/test.html <-- works there
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

&nbsp; is a hell lot netter than "Content", scrotaye :P :lol:
Post Reply