height 100% issue on Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ilesh
    New Member
    • Aug 2006
    • 3

    height 100% issue on Firefox

    Hello there

    I am new to the forum, but was wondering if you could point me in the right direction?

    I have a site that works fine in IE. The site was created by someone else and done using tables. So the page looks like this:-

    A top image, left hand side nav bar. content next to it. And then bottom bar set to stay at bottom. Now the content area is set to overflow:auto, so the scroll bars appears within the content area and leave all the other areas locked in the screen.

    This does not happen in firefox, the scroll bar instead appears for the full screen and not just for the content area itself.

    Can you help?

    Thank you

    Ilesh
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    You should post a link to the page so we can see the problem.

    Start by validating your html at www.w3c.org (look on the right hand side for the HTML validator). to have the page work well cross browser it will need to be in complient HTML so that they can all understand it.

    Comment

    • ilesh
      New Member
      • Aug 2006
      • 3

      #3
      Hello Banfa

      To be honest I would just like to know how I could do this using XHTML and CSS?

      Because we are thinking of converting the table structure into XHTML.
      So really I should have posted the following question:-

      We have a top image of width 100%
      We have a left hand nav bar and then next to it is the content area
      We also have a bottom nav bar which is locked to the bottom of the screen.
      So in IE I know this works, but for Firefox, how could I make the content area scrollable in its own div tag? As the content may not be large enough therefore overflow would be set to auto. But if it is large enough then I would like the content area to 100% depending on the browser size. So if I resized the browser it should flow without problems. I say this because I have specified a height for the content area and it looks fine, but what if the browser is not running 800px by 600px? Then it would look wierd.

      So really is there a way to make a div area scrollable and make it height 100%?

      Sorry for the confusion before

      Thanks

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        From you description you should be able to do what you want using XHTML and CSS, however in a case like this it is true that 1 sample webpage is worth 10000 forum postings :D

        There is a problem in setting 100% height because it relates the height of an element to the height of it's container. However if that container is not of fixed height (like say the body of the document that sizes itself to the height of the content) then it will be dependent on the height of it's content so you end up with the contents height dependent on the container who's height is dependent on the content which clearly doesn't work.

        I guess you have set the body to 100% and the content div to some other percentage. This works in MSIE but is not part of the CSS standard. The CSS standard does define ways of doing what you want but unfortunately MSIE is not standard complient enough to support them.

        However mixing methods gives the following which sort of works in both IE and FireFox


        Code:
         
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          
         
        <html>
        <head>
        <meta name="generator" content="microsoft visual studio 6.0">
        <title></title>
        </head>
        <body style="height: 100%; margin: 0; padding: 0;">
         
        <div style="position: absolute; top: 5%; left: 5%; right: 5%; bottom: 5%; height: 90%; background-color: #ccf; overflow: auto;">
         
        <!-- Content Here ->
         
        </div>
         
        </body>
        </html>
        Last edited by Niheel; Aug 11 '06, 06:19 AM.

        Comment

        • ilesh
          New Member
          • Aug 2006
          • 3

          #5
          Thanks for your help Banfa, I am looking at this, but am currently assigned another project. When I return to this project I will try this out.

          Again thanks for your input, I am learning a lot.

          Ilesh

          Comment

          • Samus
            New Member
            • Oct 2006
            • 4

            #6
            hello, I'm a newcomer who found this place just for the same issue, very interesting forum I'll try to be around.


            About this I have a question, you've said that:
            Originally posted by Banfa
            There is a problem in setting 100% height because it relates the height of an element to the height of it's container.
            which is basically true -but- body is not the outermost element, html is and html always have the width and height of the browser's client area.

            An example:
            Code:
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
              <head>
                <title></title>
                <style>
                  html {
                    border: 1px solid red;
                  }
                </style>
              </head>
            
              <body>
              </body>
            </html>
            So, what's wrong here? why setting the height of the body tag does not renders it based on it's container (which is the html tag).
            Thank you.

            Comment

            • Samus
              New Member
              • Oct 2006
              • 4

              #7
              hi! I've found something interesting here: http://apptools.com/examples/tableheight.php it shows a way to do it setting both the height of the html and body tags to 100%, it says that does not work on IE on Mac but here: http://blog.deconcept.com/2005/01/02...l-flash-embed/ is another example that applies the same technique and it supposed to work even there.

              Comment

              • rapsody
                New Member
                • Oct 2006
                • 2

                #8
                I have a similar problem I using xhtml strict in firefox....I have a header <div> then a middle <div> and thjen a footer <div>.

                The middle <div> is made up of two <div> left and right (parraell) the data in each is expandable. if the right txt has more txt than the left one the footer <div> starts to display in the right <div>.

                I have put the height of each left and right <div> 100% and the middle <div> 100% but it doesn't solve the problem...any ideas

                Comment

                • toxicpaint
                  New Member
                  • Sep 2006
                  • 58

                  #9
                  Try adding this to your footer css

                  clear: both;

                  From what you described, I had the same problem...

                  Comment

                  • drhowarddrfine
                    Recognized Expert Expert
                    • Sep 2006
                    • 7434

                    #10
                    You have to keep asking the question "100% of what?" Even though you set 100% height on the middle div, it is 100% of what? If the body is the next parent element, is it set to 100%? Is the next element, html, set to 100%? The html element is the only element that gets a default size which is the viewport of the browser but you still must specify if you want it to be 100% of that.

                    Another way around this is to set an actual size to the middle div using ems or px. Then 100% becomes 100% of that.

                    In any case, Firefox is doing all this correctly.

                    Comment

                    • vtkiet05
                      New Member
                      • Oct 2007
                      • 1

                      #11
                      This is complete: Create Master page using DIV tags

                      [html]
                      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
                      <html xmlns="http://www.w3.org/1999/xhtml">
                      <head>
                      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                      <title>Untitl ed Document</title>
                      <style type="text/css">
                      <!--

                      body, p, td, li, div, html
                      {
                      font-family: arial, verdana, helvetica, monospace;
                      color: #000080;
                      font-size: small;
                      height:100%;
                      width:99%;
                      }
                      #leftspace {
                      float:left;
                      text-align: center;
                      width: 10%;
                      height:100%;
                      background-color:#006699;
                      background-repeat:repeat-y;
                      }

                      #container
                      {
                      float:left;
                      text-align: center;
                      width:78.56%;
                      }

                      #rightspace {
                      float:left;
                      text-align: center;
                      width: 10%;
                      background-color:#006699;
                      background-repeat:repeat-y;
                      height:100%;
                      }

                      #leftscroll {
                      float:left;
                      text-align: center;
                      width: 7px;
                      height:100%;
                      /*background-image:url(image s/home_bg05.gif); */
                      background-color:#ff0000;
                      background-repeat:repeat-y;
                      }
                      #rightscroll {
                      float:left;
                      text-align: center;
                      width: 7px;
                      height:100%;
                      /*background-image:url(image s/home_bg04.gif); */
                      background-color:#ff0000;
                      background-repeat:repeat-y;
                      }

                      #header {
                      float: left;
                      border: 1px solid #8690ab;
                      text-align: center;
                      height: 100px;
                      width: 99.8%;

                      }
                      #left {
                      float:left;
                      width: 20%;
                      height: auto;
                      border: 1px solid #8690ab;
                      }

                      #middle {
                      float:left;
                      width: 59.49%;
                      border: 0px solid #8690ab;
                      height:auto;
                      }

                      #right {
                      float:left;
                      width: 20%;
                      height: auto;
                      border: 1px solid #8690ab;
                      }

                      #footer{
                      float: left;
                      border: 1px solid #8690ab;
                      text-align: center;
                      height: 60px;
                      width: 99.8%;
                      }

                      -->
                      </style>
                      </head>

                      <body style="width:99 .8%; border: 1px solid #ff0000 ">
                      <div id="leftspace"> </div>
                      <div id="leftscroll" >&nbsp;</div>
                      <div id="container" >

                      <div id="header">Thi s is the header section</div>

                      <div id="left">
                      Category 1 <br />
                      Category 2 <br />
                      Category 3 <br />
                      </div>

                      <div id="middle">
                      <br />
                      A frequently asked question in CSS forums is how to create pages that stretch vertically to fill the browser window, regardless of the amount of content. With tables, you would nest your entire design in a table with a single cell and set both the cell and table's height to be 100 percent. With CSS, it's also quite simple and easy. In this tutorial, you will learn the basic CSS technique for making pages fill the browser window, which you can also use any time you have a div that you want to stretch to fill its parent.
                      <br />

                      </div>

                      <div id="right">Colu mn 3 content </div>

                      <div id="footer"><b r />This is the footer section<br />Mangrove CM, Vietnam </div>
                      </div>
                      <div id="rightscroll ">&nbsp;</div>

                      <div id="rightspace" >&nbsp;</div>
                      </body>
                      </html>[/html]
                      Last edited by drhowarddrfine; Oct 18 '07, 01:53 PM. Reason: Please use code tags

                      Comment

                      • drhowarddrfine
                        Recognized Expert Expert
                        • Sep 2006
                        • 7434

                        #12
                        I guess you didn't notice this topic is over a year old?

                        Comment

                        Working...