Grow your CSS skills. Land your dream job.

window height and document height…

  • # July 18, 2013 at 7:25 am

    as I found on web $(window).height() gives unit less pixel value of browser view-port height and, $(document).height() gives unit less pixel value of actual document height

    and if document height is less than window height then $(document).height() will result in window height..

    in my case I have a document which is 36px of height..

    when I check $(window).height(), $(document).height() are giving same result as 36..

    can someone explain what’s wrong with my browser..?

    # July 18, 2013 at 7:51 am

    I worked it out…

    I had following doctype

    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    when I change it to

    < !DOCTYPE HTML>

    window height as well as document heights are resulting in 895… why so?

    # July 18, 2013 at 12:36 pm

    Weird that changing the doctype would change the value. I’m not sure I understand that one!

    # July 19, 2013 at 4:02 pm

    The most I know is that different doctypes can cause differences in how the page is rendered. Invalid doctypes can also cause browsers to enter quirks mode (which I don’t think is the case here because it looks correct to me) which could also cause all sorts of weird behavior.

    I would really love to find out the reason for this; it’s just so bizarre. “This week on Unsolved MyCSSteries!”

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".