www.webdeveloper.com
Results 1 to 10 of 10

Thread: [RESOLVED] Set height of <div> to full height of the page

  1. #1
    Join Date
    May 2005
    Posts
    230

    resolved [RESOLVED] Set height of <div> to full height of the page

    Is there any way to set the HEIGHT of a <DIV> object to be the same as the full height of the page (NOT screen) such that it covers the page even if the page is scrolled down?

    (If this is not possible, is there a way to make the layer always be in the top left corner of the screen (NOT page) such that if HEIGHT is 100% then scrolling up/down will still mean the <DIV> spans the full height of the screen?)

    thanks a lot in advance...

  2. #2
    Join Date
    Nov 2005
    Location
    127.0.0.1
    Posts
    329
    yeah, all you have to do is use a #container div. and make sure that the stuff that you want the #container div to stretch to aren't floated.
    my computer suffers from short-term memory loss.

  3. #3
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

  4. #4
    Join Date
    May 2005
    Posts
    230
    I'm not sure how the #container approach works.

    What I am trying to do is to create a <div> that stretches the full height and widhth of the page (not screen) and which overlays the actual content of my page. That way I can manage some onmousedown / onkeydown events as they would relate to the whole page.

    I know I can manage page events through document.onmousedown and document.onkeydown events, but these include also the scroll-bar, so if I was to reject either event, the user could not even scroll the page. What I want to achieve instead is for the user to be able to view / scroll the page, but not click on any of the objects of the page. Right now, my best shot at achieving this is to try an overlay it with a <div> and then trap the onmousedown and onkeydown events of the <div>.

  5. #5
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357
    And if I were to disable JavaScript - or view the source - or take a screen shot - I would have access to anything

  6. #6
    Join Date
    Mar 2006
    Posts
    13

    Wink Absolute container div

    All u do is create on abolute div with width abd set to 100% and put all your divs in there.

    This means that all your content will fit the screen size no matter how big or small your screen resolution is.

    Cheers

  7. #7
    Join Date
    May 2005
    Posts
    230
    The purpose of this overlay is not security (thanks for the heads-up though, bathurst_guy) , but to manage a print preview page (which should be for viewing only, but not for interaction).

    I've seen pages where this was somehow achieved (ie, you could scroll but not click / type), but just can't seem to recall where and I'm not able to replicate it yet.

    If there is no possibility of a fully stretched <div> (to the size of the page), perhaps some thoughts on dynamic <div>, where the div is always in view (even if u scroll)....

  8. #8
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    but to manage a print preview page (which should be for viewing only, but not for interaction)
    Don't tell me some browser lets you interact with a print preview image.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  9. #9
    Join Date
    May 2005
    Posts
    230
    This is a manually prepared page using content from the main page which is then printed using window.print() command. Because I'm copying some of the content from the main page, I am also replicating objects such as <select> and <input>. What I want is to disable interactivity with these objects (without going through them one by one and setting them to disabled).

  10. #10
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles