M
msubodh
I have been able to piece together the following code to created a
fixed div so that it stays in place even when scrolling (and does it
smoothly as opposed to other approaches that have jerky transitions.)
I only need this to work on IE 6 so I dont mind if my solution is IE
specific.
The problem I have is with the DOCTYPE. I have to deal with html page
that is autogenerated but I have control over the body. So I can add
the stylesheet that I want later on, but I cannot change the DOCTYPE
(the autogenereated page is actually without any doctype). Wihtout the
doctype, the following code does not work.
Anyone know of any way to dynamically change the doctype or any other
suggestions as to how I can accomplish this? Thank you.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<style type="text/css">
body {margin:0; padding:0 10px 0 10px; border:0; height:100%; overflow-
y:auto; background:rgb(123,187,221);}
#menu {display:block; top:10px; left:170px; width:130px;
position:fixed; border:1px solid #888; padding:10px; text-
align:center; font-weight:bold; color:#fff;
background:url(grid2.gif);}
* html #menu {position:absolute;}
/*<![CDATA[*/ html {overflow-x:auto; overflow-y:hidden;}/*]]>*/
</style>
<div>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
</div>
<div id = "menu">
This is the menu
this is the second line
</div>
</body>
</html>
fixed div so that it stays in place even when scrolling (and does it
smoothly as opposed to other approaches that have jerky transitions.)
I only need this to work on IE 6 so I dont mind if my solution is IE
specific.
The problem I have is with the DOCTYPE. I have to deal with html page
that is autogenerated but I have control over the body. So I can add
the stylesheet that I want later on, but I cannot change the DOCTYPE
(the autogenereated page is actually without any doctype). Wihtout the
doctype, the following code does not work.
Anyone know of any way to dynamically change the doctype or any other
suggestions as to how I can accomplish this? Thank you.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<style type="text/css">
body {margin:0; padding:0 10px 0 10px; border:0; height:100%; overflow-
y:auto; background:rgb(123,187,221);}
#menu {display:block; top:10px; left:170px; width:130px;
position:fixed; border:1px solid #888; padding:10px; text-
align:center; font-weight:bold; color:#fff;
background:url(grid2.gif);}
* html #menu {position:absolute;}
/*<![CDATA[*/ html {overflow-x:auto; overflow-y:hidden;}/*]]>*/
</style>
<div>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
this is some other text</br>
</div>
<div id = "menu">
This is the menu
this is the second line
</div>
</body>
</html>