Forum Moderators: not2easy

Message Too Old, No Replies

css mimics position:fixed in IE - almost. help!

         

nevdev

3:35 pm on Feb 15, 2006 (gmt 0)

10+ Year Member




I have a CSS layout that I cobbled together from various sources, and it appears to get around the inability of IE to display fixed boxes - except, the content scrollbar disappears in IE! Is it possible to fix this bug while keeping the layout?

The CSS:

1. standards.css

html
{
padding: 0px;
background-color: lightgrey;
}
body {
height: 100%;
margin: 0px;
padding: 0px;
}

#headerwrapper {
position:fixed;
left:0px;
top:0px;
width: 100%;
height: 120px;
background-color:#006600;
z-index:7;
}

#header {
position:absolute;
left:0px;
top:0px;
width: 100%;
height: 120px;
background-color:#006600;
z-index:7;
}

div.nav {
position: fixed;
width: 200px;
left: 0px;
top: 0px;
background: #006600;
padding-top: 30px;
padding-left: 0px;
/* This value controls the vertical bar */
height: 100%;
margin: 0px 0px 0px 0px;
}
#navcontent {
position:absolute;
top:120px;
left:0px;
width: 200px;
margin: 20px 0px 0px 0px;
color:red;
}
div.content {
margin: 120px 0px 0px 220px;
padding: 0px;
}
/* -- End basic layout section -- */
div.content p {
font: 100% "Trebuchet MS", Arial, Geneva, san-serif;
color: #333333;
text-align: justify;
padding-top: 15px;
padding-right: 10px;
padding-left: 10px;
}
div.content a {
color: #6666CC;
}
div.content a:hover {
color: #CCCCCC;
background: #AA9FAA;
text-decoration: none;
}
.nav p {
font: 100%/1 Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
display: block;
padding-top: 0px;
margin: 0px;
padding-left: 10px;
}
div.nav a {
color: #FFFFFF;
background: #9faa9f;
width: 150px;
display: block;
margin: 0px;
padding-top: 6px;
padding-bottom: 1px;
padding-left: 20px;
text-decoration: none;
height: 18px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
}
div.nav a:hover {
color: #333333;
background: #999999;
width: 150px;
display: block;
margin: 0px;
padding-top: 6px;
padding-bottom: 1px;
padding-left: 20px;
text-decoration: none;
height: 18px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
}

2. iehack5.css

/* Amends and adds rules needed by IE5.x to standards.css */
body {
overflow: hidden;
background-color: lightgrey;
z-index: 1;
}
div.nav {
position: absolute;
z-index: 6;
overflow: hidden;
}
.spacer {
position: absolute;
margin-bottom: 0px;
width: 200px;
/* top: 0px; */
left: 0px;
bottom: 0px;
background: #AA9FAA;
height: 100%;
z-index: 5;
}
div.content {
margin: 120px 0px 0px 0px;
margin-left: 0px;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
padding-left: 220px;
z-index: 4;
height: 100%;
overflow-x: hidden;
overflow-y: scroll;
}

3. iehack6.css

/* Amends and adds rules needed by IE6 to standards.css */
html {
overflow: hidden;
}
body {
background-color: lightgrey;
overflow: auto;
}
div.nav {
position: absolute;
background: #006600;
padding-top: 30px;
padding-left: 0px;
height: 100%;
}

The HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="standards.css" rel="stylesheet" type="text/css">
<!--[if IE 5]>
<link href="iehack5.css" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 6]>
<link href="iehack6.css" rel="stylesheet" type="text/css">
<![endif]-->
</head>
<body>
<div id="headerwrapper"><div id="header"></div></div>
<div class="nav">
<div id="navcontent">
<p><a href="#">Item 1</a></p>
<p><a href="#">Item 2</a></p>
<p><a href="#">Item 3</a></p>
</div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="spacer">&nbsp;</div>
</div>
</body>
</html>

Little_G

3:47 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



Hi,

It's the,


body {
overflow: hidden;

in iehack5.css
or,

html {
overflow: hidden;

in iehack6.css that's probably responsable for the scrollbar disappearing.
Try viewing the page with these properties removed.

Andrew

nevdev

4:55 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



Hmm... taking either out brings the scrollbar back, but then it doesn't scroll properly, and the layout goes wonky also.. I'm getting so frustrated trying to get this to work.. maybe I should just go back to tables.. (*tired and confused*)