Click to See Complete Forum and Search --> : adding a scroll bar


malial
12-22-2002, 10:38 PM
Hello,

how do I add a scroll bar to a site? The "field" with the scroll bar should only be about 160 wide and about 250 in height. I'm trying to put a long list of links in the scroll bar, so that whoever views the list of links doesn't have to scroll up and down the whole page. And to make it look nicer too.

Thank you.

King Pellinore
12-22-2002, 10:59 PM
Usually they put an IFRAME there, but there is a much better solution...

Again, div comes in play. Have a div with a specified height and width and set the CSS overflow property to "scroll". Like this:


<div style="
width: 160px;
height: 250px;
overflow: scroll;">Your links.</div>

Note: in XHTML the style attribute is deprecated. Use a style tag or a style link instead, to be forward-compatible.

_______EDIT_____
Note: this is a generally much better thing to use than an IFRAME, because of semantics issues. Like search engine indexing - they will only show the inside of the IFRAME, they can't load a frameset page and then load your page through it.
Also, another useful overflow attribute is hidden, when the contents are cropped from the div and it retains its dimensions nicely.

malial
12-22-2002, 11:05 PM
Thank you, thank you, thank YOU. This worked out great!

Stefan
12-23-2002, 02:44 AM
Originally posted by King Pellinore
overflow: scroll


Alternativly you could use
overflow: auto
instead. That will only add a scrollbar if it's needed and only in the direction it's needed.


Note: in XHTML the style attribute is deprecated. Use a style tag or a style link instead, to be forward-compatible.


Style is not deprecated in XHTML, but using global or especially external CSS is a good advice anyway. :)

Rick Bull
12-23-2002, 06:51 AM
It's probably going to deprecated in XHTML 2.0 isn't it? Or was that just the style element?

Stefan
12-23-2002, 08:52 AM
Originally posted by Rick Bull
It's probably going to deprecated in XHTML 2.0 isn't it?

Probably yes, but meanwhile XHTML 1.0 and 1.1 support it and 2.0 is only a draft at present and not a finished spec.