SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css height of browser

    Hello

    Is it possible to make the height of a div relative to the browser size?

    e.g if the height of the browser is 800px, set my div height to 800px

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,343
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Jaynesh View Post
    Hello

    Is it possible to make the height of a div relative to the browser size?

    e.g if the height of the browser is 800px, set my div height to 800px
    See the CSS faq on 100% height (link in my sig) and if that's not what you meant then come back here and post again

  3. #3
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,798
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    In addition to reading Paul's FAQs, which are always very informative, there are some things you must keep in mind.

    UNLESS you are giving the DIV position:fixed; or all it's parent's are already 100% height of the vierwport ( which has it's own undesirable side effects, you really can't achieve 100% viewport height.


    Even in Paul's 100% height demo. It's a one shot deal. It is useful to structure your markup around this and consider the occasional positioning trick.

    It is also useful to know what you are trying to achieve in actuality ( some folks may think they want to make some element fill the full height of the screen .. when in fact what they need is equal height columns)


Bookmarks

Posting Permissions

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