473,387 Members | 2,436 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.

Only Vertical Scroll bar no horizontal bars

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!
-----------------------------------------------
Aug 26 '05 #1
4 134358
In article <Pe*******************@fe04.news.easynews.com>,
ju****************************@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/
Aug 26 '05 #2
justdummy wrote:

<div style="height:200px; overflow:scroll">

Try "overflow: auto".

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Aug 26 '05 #3
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
Aug 26 '05 #4

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

Gérard
--
remove blah to email me
Aug 26 '05 #5

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

Similar topics

0
by: David Pratt | last post by:
Hi. I am putting together a database application on Zope. I have built a pager for my records (20 per page) but do not want the browser scroll bars to reset to the top of the browser each time the...
3
by: David Rwj Cherry CS2000 | last post by:
is there any way to disable or lock vertical scroll bars on a browser window? im a newbie and i just don't want them to appear on my screen. sometimes they appear on IE but not on mozilla. any...
3
by: AES/newspost | last post by:
Just been involved with a web site where clicking a button on the main page opened a second (or secondary) window intended to function like a dialog box in Apple GUI jargon. (The primary page was...
1
by: Ted | last post by:
I am trying to return the vertical scroll position of a rich textbox control using Access 2000. It seems to work for the horizontal scroll bar, but not the vertical. Code follows: Option...
0
by: Sachin | last post by:
How to match the look and feel of vertical scroll bar with the inbuilt vertical scroll bars of some controls like PrintPreviewControl, Rich Text box , etc. Their scroll bars look blue where the...
0
by: Joey | last post by:
Hello friends, somebody knows as adding bars of Vertical and horizontal displacement to a picture where I have a big image that he/she doesn't enter in the form. Greetings and thank you. --...
1
by: Karl | last post by:
I have a A2000 form that won't show the vertical scroll bar. I have the scroll bar format set to show Both. The horizontal bar works fine. I tried settting the format to show vertical only and it...
4
by: Matthew Cox | last post by:
Hi, I've been searching the net all day today trying to figure out how one would accomplish what I originally thought would be a fairly straight forward and simple thing. The problem I'm trying...
4
by: simulationguy | last post by:
Any of you run into this, i have tried setting the properties of the form to vertical scroll bars only and both neither seems to work. The horizontal scroll bar works fine but its a long form and I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.