Solved

CSS positioning horizontal blocks IE6

Posted on 2011-02-14
14
225 Views
Last Modified: 2012-05-11
i want to split my spreadsheet into three horizontal blocks top, middle and bottom. I want the top to take up 15% of the screen, the middle 80% and the bottom 5%. I also want them to keep these % as the browser window is resized. Ive tried looking at relative , floating etc but havnt been able to work this one out
0
Comment
Question by:LBGUC04
  • 6
  • 5
14 Comments
 
LVL 9

Expert Comment

by:CCSOFlag
ID: 34888852
you will need to use absolute positioning along with percentage heights:

      <div id="Top" style="height: 15%; background-color: #000; position: absolute; top: 0; width: 100%;">
    </div>
      <div id="Middle" style="height: 80%; background-color: #666; position: absolute; top: 15%; width: 100%;">
    </div>
      <div id="Bottom" style="height: 5%; background-color:#CCC; position: absolute; top: 95%; width: 100%;">
    </div>
0
 
LVL 9

Expert Comment

by:CCSOFlag
ID: 34888863
although I can't test it in IE6, but it SHOULD work in IE6.  
0
 

Author Comment

by:LBGUC04
ID: 34888998
the bars are in the right place but there is no height to them so they dont appear as full color blocks
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 9

Expert Comment

by:CCSOFlag
ID: 34889021
even with the height style set to their corresponding percentages?
0
 

Author Comment

by:LBGUC04
ID: 34889059
even with the % ive also just tried adding display: block bu this hasnt sorted it either
0
 
LVL 9

Expert Comment

by:CCSOFlag
ID: 34889297
ok well IE6 was retarded when it came to divs.  Try converting it to a table like this:

      <table>
      <tr id="Top" style="height: 15%; background-color: #000; position: absolute; top: 0; width: 100%;">
          <td>
            text on top
        </td>
    </tr>
      <tr id="Middle" style="height: 80%; background-color: #666; position: absolute; top: 15%; width: 100%;">
          <td>
          text in middle
        </td>
    </tr>
      <tr id="Bottom" style="height: 5%; background-color:#CCC; position: absolute; top: 95%; width: 100%;">
          <td>
          text on bottom
        </td>
    </tr>
         </table>
0
 

Author Comment

by:LBGUC04
ID: 34894745
The height of the color is only 1 row in thickness is there anyway to get it to fill the whole % of each horizontal line?
0
 

Author Comment

by:LBGUC04
ID: 34894803
ive also noticed that when resizing the screen it doesnt keep auto adjust the % very well. its anoying as i had this working in IE7 but i need to have it working on IE6
0
 
LVL 9

Expert Comment

by:CCSOFlag
ID: 34896979
try adding min-height: 15%/80%/5% to the corresponding sections.  I feel your pain.  I spent countless hours trying to get stuff to work in IE6, until I was finally able to convince my organization to upgrade to IE7.  :)  
0
 

Author Comment

by:LBGUC04
ID: 34915000
Ive tried many different approaches to this now, does anyone else have any ideas on how to get this to work?
0
 
LVL 16

Accepted Solution

by:
SSupreme earned 500 total points
ID: 35081908
Try this out:
 
<!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>

<style type="text/css">
* {	margin: 0px; padding: 0px;}  
html, body {height:100%; width:100%}
#page {width:70%; height:100%; margin: 0 auto;}
#top {width:100%; height:15%; background:green;}
#middle {width:100%; height:80%; background:orange;}
#bottom {width:100%; height:5%; background:pink;}
</style>

</head>
<html>
<body>
 <div id="page" >
 <div id="top" >
 
 </div>
 <div id="middle" >
 
 </div>
 <div id="bottom" >
 
 </div>
 </div>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:LBGUC04
ID: 35206104
Many thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question