View Full Version : Creating Scrollbars

02-15-2005, 08:56 PM

I have a simple layout idea for my webpage but I'm having trouble creating it.

So far I have created a square (300x300pixel) table in the centre of my homepage.

I am now inputing text into the table but whenever the text reachs the bottom of the table Dreamweaver automatically increases the table's size.

I want to add a scrollbar to the table so that it's dimensions will stay fixed regardless of how much text i input. How can i do this?


02-15-2005, 10:49 PM
Don't use a table.

Use a layer (div) in Dreamweaver terms.

Draw the layer to the size you want

call it : <div style="overflow:scroll"> your content </div>

Be warned that this will not necessarily work in all browsers.


02-16-2005, 03:24 PM
We also added an article recently about this technique called CSS Scroller ('http://www.dreamweaverclub.com/css-scroller.php').
The article is geared a little more towards the handcoder than the layout-view user of Dreamweaver.

02-16-2005, 05:04 PM
Thanks for the suggestions guys!

Using a layer works well, the only problem now is that I can't make the layer automatically re-position itself to the centre of a browser window when the browser window is resized. I was able to achieve this with a table.

I tried making a layer within a table that was auto-centred but the layer did not move with the table when the table re-alligned itself, instead it stayed at it's co-ordinates.

Any suggestions?

02-16-2005, 05:39 PM
Posting the url or code to the page would help ;)

My guess is that you are absolutely positioning the layer (div), remove the absolute positioning, and you should be fine. ie; change position:absolute to position:relative and remove the top/left properties as well if they're in there.

02-16-2005, 07:03 PM
I realised that if I input the value for "left" as a percentage rather than as a pixel position then it re-positions itself as the browser re-sizes.

I think that solves it!

Thanks again for all the help.