Welcome to WebmasterWorld Guest from 54.234.63.187

Forum Moderators: open

Message Too Old, No Replies

Forcing Browser to have right scrollbar

Firefox, Netscape, Opera....

     

limbo

4:35 pm on Feb 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The one thing that bugs me a little about modern browsers is when a page is centred and the content drops either side of the 'fold' on different sized pages, the scroll bar appears and reappears jogging the pages 10px left and right. Makes the page look like it has design bugs. Is there a way to force the browser to display the right scroller?

Cheers, Limbo

>> edited for typos (title should say right scroller!)

encyclo

4:48 pm on Feb 23, 2005 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



OK, ugly hack alert!

To force a scrollbar, you need to use absolute positioning to place a div just below the bottom of the viewing area. So we do this:

CSS:

#scroll {
position:absolute;
top:0;
bottom:-0.1px;
width:1em;
z-index:-1;
}

And (X)HTML:

<div id="scroll"></div>

Let's not mention semantics, shall we! ;)

limbo

7:07 pm on Feb 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah that's what we call hacking, chop socky with divs, I'll give it whirl.

Ta

electricocean

6:34 am on Feb 24, 2005 (gmt 0)

10+ Year Member



Are you trying to make the scroll bar on the right and not the left?

I tried that css code along with the xhtml and it didn't do anything...

electricocean

BlobFisk

9:54 am on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



electricocean, we are talking about a right scrollbar here! And I think that limbo is looking for it to be on the browser as oppossed to a <div>

limbo, if you are happy that the entire page has a scrollbar, which I think you were saying in your post, why not just try:


html {
overflow: scroll;
}

This should force the browser to always display a scrollbar... One problem with this is that you will get a scrollbar area (faded) horizontally along the bottom too which may not look very good.

To combat this you could use overflow-y instead but you won't get much cross browser support for this one.

HTH

[edited by: BlobFisk at 9:59 am (utc) on Feb. 24, 2005]

limbo

9:55 am on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Implemented this morning. Thanks, my design head can rest assured of browsing tranquility. Of course my coding head will know it's there, which will cause me some discomfort, but the fluidising effect it has had outwieghs the knowledge it aint' semantically correct :)

/** added -- cor Blob you posted within a second of me replying to Encyclo! I think that might be a more elegant method too **/

 

Featured Threads

Hot Threads This Week

Hot Threads This Month