Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. CSS question ?

CSS question ?

Scheduled Pinned Locked Moved Web Development
questioncsshelp
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mohammad Dayyan

    Hi. I have a DIV tag . I want to fix maximum height of it with height of the browser (FF or IE) how can I do it ?

    D Offline
    D Offline
    David Muir
    wrote on last edited by
    #2

    Hi, As far as im aware you can just add the following to your css code. Not 100% sure as its been a while since i did web development, but i dont think this can be set in IE. div { max-height: 1000px; overflow: auto; } Many thanks, TF

    M 1 Reply Last reply
    0
    • D David Muir

      Hi, As far as im aware you can just add the following to your css code. Not 100% sure as its been a while since i did web development, but i dont think this can be set in IE. div { max-height: 1000px; overflow: auto; } Many thanks, TF

      M Offline
      M Offline
      Mohammad Dayyan
      wrote on last edited by
      #3

      Thank you DJ. I tested it. But it wasn't thing that I wanted. :(

      D 1 Reply Last reply
      0
      • M Mohammad Dayyan

        Hi. I have a DIV tag . I want to fix maximum height of it with height of the browser (FF or IE) how can I do it ?

        P Offline
        P Offline
        Perspx
        wrote on last edited by
        #4

        You can do it with Javascript: function setHeight(id) //id is the ID of the div { var d = document.getElementById(id); d.style.position = "absolute"; d.style.height = document.body.clientHeight; } --Perspx

        "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
        BSoD during a Win98 presentation

        M 1 Reply Last reply
        0
        • P Perspx

          You can do it with Javascript: function setHeight(id) //id is the ID of the div { var d = document.getElementById(id); d.style.position = "absolute"; d.style.height = document.body.clientHeight; } --Perspx

          "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
          BSoD during a Win98 presentation

          M Offline
          M Offline
          Mohammad Dayyan
          wrote on last edited by
          #5

          Thank you. I tested your function, but it just return zero (0) :confused:

          function setHeight()
          {
          var d = document.getElementById('main');
          d.style.position = "absolute";
          d.style.height = document.body.clientHeight;
          alert(document.body.clientHeight);
          }

          P 1 Reply Last reply
          0
          • M Mohammad Dayyan

            Thank you DJ. I tested it. But it wasn't thing that I wanted. :(

            D Offline
            D Offline
            David Muir
            wrote on last edited by
            #6

            Sorry, misread your question, thought you meant set a maximum height on the div rather than div to maximum height of window. html { height: 100%; } body { min-height: 100%; height: 100%; } div { height: 100%; min-height: 100%; } (div would be given name of your div) This might work, again not 100% sure. TF

            M 1 Reply Last reply
            0
            • M Mohammad Dayyan

              Thank you. I tested your function, but it just return zero (0) :confused:

              function setHeight()
              {
              var d = document.getElementById('main');
              d.style.position = "absolute";
              d.style.height = document.body.clientHeight;
              alert(document.body.clientHeight);
              }

              P Offline
              P Offline
              Perspx
              wrote on last edited by
              #7

              It should work.. I tested it in Opera and IE. Where are you calling the function from? Because in IE it's a bit awkward, I think you have to call it on the onLoad() handler or after it or something.. --Perspx

              "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
              BSoD during a Win98 presentation

              M 1 Reply Last reply
              0
              • P Perspx

                It should work.. I tested it in Opera and IE. Where are you calling the function from? Because in IE it's a bit awkward, I think you have to call it on the onLoad() handler or after it or something.. --Perspx

                "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
                BSoD during a Win98 presentation

                M Offline
                M Offline
                Mohammad Dayyan
                wrote on last edited by
                #8

                I tested in FF3 and IE6. I call it on the onLoad handler.

                P 1 Reply Last reply
                0
                • D David Muir

                  Sorry, misread your question, thought you meant set a maximum height on the div rather than div to maximum height of window. html { height: 100%; } body { min-height: 100%; height: 100%; } div { height: 100%; min-height: 100%; } (div would be given name of your div) This might work, again not 100% sure. TF

                  M Offline
                  M Offline
                  Mohammad Dayyan
                  wrote on last edited by
                  #9

                  Wow. thank you very much. but it doesn't work in IE6. :(

                  D 1 Reply Last reply
                  0
                  • M Mohammad Dayyan

                    Wow. thank you very much. but it doesn't work in IE6. :(

                    D Offline
                    D Offline
                    David Muir
                    wrote on last edited by
                    #10

                    sadly cant test in ie6, dont have it installed, only ie7 :( it does however work fine in ie7 if thats any help :) TF

                    M 1 Reply Last reply
                    0
                    • D David Muir

                      sadly cant test in ie6, dont have it installed, only ie7 :( it does however work fine in ie7 if thats any help :) TF

                      M Offline
                      M Offline
                      Mohammad Dayyan
                      wrote on last edited by
                      #11

                      However thank you my friend.

                      1 Reply Last reply
                      0
                      • M Mohammad Dayyan

                        I tested in FF3 and IE6. I call it on the onLoad handler.

                        P Offline
                        P Offline
                        Perspx
                        wrote on last edited by
                        #12

                        You can also use document.body.offsetHeight, however this will only return the browser client height if there is no vertical scrolling on the page, and if you dont want the DIV to be larger than the client height of the browser just assign this to a variable on the onLoad handler and use it afterwards? Also, try out IE 7 - document.body.clientHeight worked fine for me there. Hope this helps, --Perspx

                        "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
                        BSoD during a Win98 presentation

                        M 1 Reply Last reply
                        0
                        • P Perspx

                          You can also use document.body.offsetHeight, however this will only return the browser client height if there is no vertical scrolling on the page, and if you dont want the DIV to be larger than the client height of the browser just assign this to a variable on the onLoad handler and use it afterwards? Also, try out IE 7 - document.body.clientHeight worked fine for me there. Hope this helps, --Perspx

                          "Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
                          BSoD during a Win98 presentation

                          M Offline
                          M Offline
                          Mohammad Dayyan
                          wrote on last edited by
                          #13

                          Thank you .

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups