Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts

    how to position the scrollbar?

    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 . . .

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Posts
    190
    Thanks
    12
    Thanked 2 Times in 2 Posts
    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?

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    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?

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    I know that but there must be an option how to control the scroll bar position...

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

  • #6
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    I'd bet real money that there's a javascript solution for that.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #7
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by abduraooft View Post
    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.
    Quote Originally Posted by joda View Post
    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

  • Users who have thanked oesxyl for this post:

    joda (11-05-2009)

  • #8
    Regular Coder
    Join Date
    Apr 2009
    Location
    Earth - sometimes sky :-)
    Posts
    121
    Thanks
    51
    Thanked 2 Times in 2 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •