Click here to get back home

Only Vertical Scroll bar no horizontal bars

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Only Vertical Scroll bar no horizontal bars justdummy 08-26-2005
Posted by justdummy on August 26, 2005, 3:44 am
Please log in for more thread options


Hi,

I am struggling with a problem for sometimes. I need to display a table in
a html and if the height of the table goes beyond 200 px then a vertical
scrollbar should alone appear without any horizontal scroll bar. If the
height of the table is less than 200 px then no scroll bars should appear.
Here is the html below. I tried to wrap the table around a <div> tag but
its doesn't work out as the scroll bar appear close to the scroll bar of
the page rather than close to the table. Further if the height of the
table is less than 200 px (i.e., with fewer number of rows like just 2
rows) then also the scroll bars appear.

Am I missing anything in this? Or Is there any other better solution to
this? I would appreciate any help to solve this problem.

<html><head><title>Table test</title>
<style type="text/css">
body { font-family: arial;}
table { border-color: darkblue; border-style: solid; border-width: 1px;
}
td, th {
font-family: Arial; font-size: 10pt; background-color: grey;
padding: 2px; padding-left: 6px; padding-right: 6px;
}
.section-header{
background-color: darkblue; font-size : 18px; font-weight: bold;
font-style: normal; text-align: left; padding-left: 5px; vertical-align:
middle;
}
</style>
</head>
<body>
<div style="height:200px; overflow:scroll">
<table cellpadding="0" cellspacing="1" width="800px">
<thead>
<tr style="background-color:#008000;color:#ffffff;">
<th class="section-header">name</th>
<th class="section-header">position</th>
<th class="section-header">Number added</th>
<th class="section-header">Number removed</th>
</thead>
<tbody>
<tr><td>aaa</td><td>left</td><td>122-456-789</td><td>122-456-788</td></t
r>
<tr><td>bbb</td><td>left</td><td>123-456-789</td><td>123-456-788</td></t
r>
<tr><td>ccc</td><td>right</td><td>233-456-789</td><td>233-456-788</td></
tr>
<tr><td>ddd</td><td>left</td><td>234-456-789</td><td>234-456-788</td></t
r>
<tr><td>eee</td><td>right</td><td>238-456-789</td><td>238-456-788</td></
tr>
<tr><td>fff</td><td>right</td><td>235-456-789</td><td>235-456-788</td></
tr>
<tr><td>ggg</td><td>left</td><td>236-456-789</td><td>236-456-788</td></t
r>
<tr><td>aaa</td><td>left</td><td>122-456-789</td><td>122-456-788</td></t
r>
<tr><td>bbb</td><td>left</td><td>123-456-789</td><td>123-456-788</td></t
r><tr>
<td>ccc</td><td>right</td><td>233-456-789</td><td>233-456-788</td></tr>
<tr><td>ddd</td><td>left</td><td>234-456-789</td><td>234-456-788</td></t
r>
<tr><td>eee</td><td>right</td><td>238-456-789</td><td>238-456-788</td></
tr>
<tr><td>fff</td><td>right</td><td>235-456-789</td><td>235-456-788</td></
tr>
<tr><td>ggg</td><td>left</td><td>236-456-789</td><td>236-456-788</td></t
r>
</tbody>
</table>
</div>
</body>
</html>
-------------------------------------

Thanks.



-- ---------------------------------------------
Article posted with Web
Developer's USENET Archive
http://www.1-script.com/forums
no-spam read and post
WWW interface to your favorite newsgroup -
comp.infosystems.www.authoring.html
- 14704 messages and counting!
-----------------------------------------------

Posted by Leonard Blaisdell on August 25, 2005, 9:11 pm
Please log in for more thread options


justdummy_at_coolgoose_dot_com@foo.com (justdummy) wrote:

> Hi,
>
> I am struggling with a problem for sometimes. I need to display a table in
> a html and if the height of the table goes beyond 200 px then a vertical
> scrollbar should alone appear without any horizontal scroll bar. If the
> height of the table is less than 200 px then no scroll bars should appear.
> Here is the html below. I tried to wrap the table around a <div> tag but
> its doesn't work out as the scroll bar appear close to the scroll bar of
> the page rather than close to the table. Further if the height of the
> table is less than 200 px (i.e., with fewer number of rows like just 2
> rows) then also the scroll bars appear.
>
> Am I missing anything in this? Or Is there any other better solution to
> this? I would appreciate any help to solve this problem.

> <div style="height:200px; overflow:scroll">
> <table cellpadding="0" cellspacing="1" width="800px">
<...>
> </table>
> </div>

Well, this particular table is 800px wide. You will automatically get a
horizontal scroll at less than that. You may have other problems.

leo

--
<http://web0.greatbasin.net/~leo/

Posted by Jim Moe on August 25, 2005, 11:16 pm
Please log in for more thread options


justdummy wrote:
>
> <div style="height:200px; overflow:scroll">
>
Try "overflow: auto".

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Posted by boclair on August 26, 2005, 6:23 am
Please log in for more thread options


Jim Moe wrote:
> justdummy wrote:
>
>>
>> <div style="height:200px; overflow:scroll">
>>
> Try "overflow: auto".
>
Depending on browser compatibility you might try these rules
        overflow: -moz-scrollbars-vertical;
        overflow-y: scroll;

Louise

Posted by Gérard Talbot on August 26, 2005, 5:51 pm
Please log in for more thread options



Cross-browser scrolling tbody:
http://www.gtalbot.org/DHTMLSection/ScrollingTBody.html

Gérard
--
remove blah to email me

Similar ThreadsPosted
Vertical and Horizontal Frames that Scroll Together October 7, 2004, 5:35 pm
Horizontal scroll to nowhere---why? October 23, 2007, 11:38 pm
How to save vertical scroll postion and later set it November 10, 2006, 6:08 am
Vertical scroll bar with missing bottom arrow? July 22, 2004, 8:04 pm
How to define a HTML page not allow scroll bars and resize? July 26, 2006, 3:30 pm
Frameset -> Page -> IFrame -> Frameset ...issue with scroll bars (Two issues) April 4, 2008, 6:45 pm
Is it possible to keep this on the same horizontal? February 15, 2008, 1:33 pm
Table autoadjustment in the vertical March 6, 2006, 3:43 pm
negative vertical position? December 20, 2006, 3:09 pm
Is horizontal scrolling okay? December 28, 2004, 2:52 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap