...

View Full Version : how to position the scrollbar?



joda
11-04-2009, 11:13 PM
So, here is my question:

Is there some possibility with css to put the horizontal scroll bar of the web browser into the center if the web page width are bigger then the width of the web browser screen?

Or how can I do that?

thanks to all . . .

tspek
11-05-2009, 03:19 AM
So you want the web page to have a horizontal scroll because it's wider than the users resolution and you want the page to be centered when it loads?

joda
11-05-2009, 07:43 AM
yes, that's what I wish.
But I can not use the margin-left: auto and margin-right:auto option because of the footer
of the page is more wide then the body and the margin option will use the footer width to centered the page.

But if I center the horizontal scroll then I can cut some pixels of the footer
from the left and the right side.

Here is the link so you can see whats going on: http://www.code-elektronic.com/newsite

If you use the resolution of your screen 1280x1024
then is the site centered but if you put 1024x768 then is the site out of the center of the browser and you
have to put the scroll in the center to positioning the page to he center of the browser.

So, I wish to make this "scrolling left" automatically when the user loads the page.

Is there any solution to do it with html and or css?

abduraooft
11-05-2009, 08:20 AM
If you use the resolution of your screen 1280x1024
then is the site centered but if you put 1024x768 then is the site out of the center of the browser and you
have to put the scroll in the center to positioning the page to he center of the browser. You can't center an element having a width which is greater than the available resolution. Try setting a smaller width to the outer container.

joda
11-05-2009, 08:26 AM
I know that but there must be an option how to control the scroll bar position...

I think so, maybe I'm wrong....

Rowsdower!
11-05-2009, 01:17 PM
I'd bet real money that there's a javascript solution for that.

oesxyl
11-05-2009, 02:06 PM
You can't center an element having a width which is greater than the available resolution. Try setting a smaller width to the outer container.


So, here is my question:

Is there some possibility with css to put the horizontal scroll bar of the web browser into the center if the web page width are bigger then the width of the web browser screen?

Or how can I do that?

thanks to all . . .
can't be done only with html/css. As Rowsdower! said, there is a javascript solution.
From my point of view, as I see on the link you posted, you can make the width smaller with maximum 250px for smaller windows( the gap between AKCIJE and HOME is 280px).
width in % can make the layout to grow/shrink with the window and min-width can stop to shrink more then a given width but will look different at different sizes and you must do intensive tests to find the best look.
I would not be so concerned about scroolbar. If I have a small monitor or I use a small width of the window I would expect that I need to scroll to the right to see the page. If you put the page in the middle of the window I still need to scroll it to see content, isn't it? :)

best regards

joda
11-05-2009, 09:05 PM
oesxyl that's a very good idea man!
I try to load the page on a 17inch monitor and with a resolution of 1280x1024 it's fine.Then I loaded it on a 19inch monitor with the same resolution as before and it's ok to.
But, the problem is when I load the page on this two monitor's but with the resolution of 1024x768 then I have to scroll the scroll bar to right exactly to the center of the browser and then the page is centered on the screen and is ok for me,that gives to me the result what I searching for.
So I got and idea to automatically put the scroll bar to the center to avoid to make some big code to read the screen res. etc. just scroll the horizontal scroll bar to center and all things are works great for me...
Try,change the resolution of you monitor if it is a 17 or 19 inch to 1024x768 and you would see what is happening.
But it is a very goo idea what you give to me, really fine! thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum