View Full Version : Making a div scroll vertically if overflowed...
Remotive
20-04-2008, 07:58 PM
Heya guys, well I am coding my sticker web store and I am onto the center where all the information is displayed, so basically what I want is a code for td to scroll vertically if it is overflowed...
I have tried putting style="overflow: auto;" and it didn't work, I even put a div inside the td and put style="overflow: auto;" then my content inside the div then closing the div again.
But nothing seems to work, is there any other code I can use that works? :(
Decode
20-04-2008, 08:34 PM
dynamic drive has alot of javascripts that do that.
Remotive
20-04-2008, 08:39 PM
Yeah I know, I am just wondering if there is any easier way to do it.
kreechin
20-04-2008, 10:11 PM
do something like this;
<style>
.ScrollDivBox {
width: 399px;
height: 212px;
background-color: transparent;
overflow: auto;
border: 0px !important;
font-family: Verdana;
font-size: 11px;
color: ffffff;
}
</style>
That bit of CSS tells the div what size it should be so when the text you want in it goes over the size given it adds the scroll bar, font, font colour, etc, place it in a CSS file or at the top of your page
Then use this code to display the Div;
<div class="ScrollDivBox">
Text text text</div>
Hope it helped :)
Remotive
21-04-2008, 02:54 PM
Erm, thanks but I already knew allof that. :P
And, it still didn't work unfortunaetly, but your help is most appreciated... :)
kreechin
21-04-2008, 04:21 PM
the code i posted works fine, after the size of the box is expanded, it adds the scrollbar..
http://free-host.ath.cx/bin/div.htm if you don't believe me, view the page source.
Remotive
21-04-2008, 05:51 PM
the code i posted works fine, after the size of the box is expanded, it adds the scrollbar..
http://free-host.ath.cx/bin/div.htm if you don't believe me, view the page source.
I do believe you, but mine is in a td and it doesn't scroll for some really strange reason it just keeps going down and doesn't stop and I have a set height...
kreechin
21-04-2008, 06:19 PM
Ahh I'm sorry about that, I didn't read your post propper, to make a TD scrollable use this code;
<style type="text/css">
#scroll {
height:50px;
width:50px;
overflow:auto;
}
</style>
and to display the scrollable TD use this;
<td>
<div id="scroll">This div will get the scroll bar when the text is bigger then the div</div>
</td>
Just needed to put a div inside the td tags.
It's overflow: scroll;
Is it not? :S
Remotive
22-04-2008, 02:18 PM
It is L?KE but it gives it a horizontal scroll as well unfortunaetly and it just looks icky. :P
Hmm.
Well I don't know.
Surely Overflow: auto; would work in this instance. Has for me before?
Rather than use a td element, bung a div into it and do the following:
<div style="width:WHATEVERpx;height:WHATEVERpx;overflow:auto;">
Content of div here.
</div>
Obviously changing WHATEVER to the size of the td.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.