Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

div resizing onresize of window

Hi,

I have created a webpage that contains a div with style attribute overflow:auto; This will make sure the div doesn't grow if the data gets too long, but data can still be read by using the scrollbars

I now want this div to get resized when the window resizes. I tried to do this using JavaScript, but I didn't get it to work. Can anyone tell me how to do this ? Do I have to use JavaScript, or is there another style attribute for this... ?

If the window gets larger the div also needs to grow with the window, and if the window gets smaller the div should also get smaller. I want to do this because I want all menus and buttonsetc. to stay in place even when the window resizes, but I may not use frames. The site should entirely be build useing div and span elements...

Hope someone can help me with this.

;-)
-mac-
mailto:mac_doggie@hotmail.com
the Netherlands...

Comments

  • WeirdofreakWeirdofreak Posts: 439Member
    It looks like you want to use percentage length values. If you set something to have width: 50%, it will remain at half the width of the user's window, however wide it is.
    ^D
    $ shameless-plug
    http://line-ed.sourceforge.net

  • mac_doggiemac_doggie Posts: 488Member
    : It looks like you want to use percentage length values. If you set something to have width: 50%, it will remain at half the width of the user's window, however wide it is.
    : ^D
    : $ shameless-plug
    : http://line-ed.sourceforge.net
    :
    :
    I've got something like this (don't bother about the terrible colors those are just for testingt his... ;-) ) ::

    [code]













    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla
    bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla bla bla bla Lorum Ipsum bla bla bla













    [/code]

    The whole page should be centered. And the content div should scroll if the data doesn't fit on the screen, but when the window gets bigger the content frame needs to grow. You get what I mean ?

    So the browser won't get a scrollbar(I hate double scrollbars) but the div will. If I use 100% value, the div will get 100% of it's container, in this case group(group = 100% of body, so eventualy the contentframe will be 100% of the body height. This is not what I want, the body height and the window height are two different things.

    How can I do this ?
    ;-)
    -mac-
    mailto:mac_doggie@hotmail.com
    the Netherlands...


Sign In or Register to comment.