473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

positioning div relative to window

hi

is it possible to position a div relative to the document window? so
for example if the page is scrolled down the div in question does not
move

regards

marc

Aug 28 '06 #1
4 2339
libsfan01 wrote:
is it possible to position a div relative to the document window? so
for example if the page is scrolled down the div in question does not
move
position: fixed.
Not supported by MSIE.
JavaScript hacks to simulate it in that browser are available. Google can
help you find them.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 28 '06 #2
On or about 8/28/2006 3:58 PM, it came to pass that David Dorward wrote:
libsfan01 wrote:
>is it possible to position a div relative to the document window? so
for example if the page is scrolled down the div in question does not
move

position: fixed.
Not supported by MSIE.
JavaScript hacks to simulate it in that browser are available. Google can
help you find them.
Fixed elements are supported by IE7 in strict mode, it acts like IE6 in
quirks mode. I use the Fixed element simulator with one of my pages, and
while it does work I feel it's kind of ugly.
Aug 28 '06 #3
totalstranger said the following on 8/28/2006 5:57 PM:
On or about 8/28/2006 3:58 PM, it came to pass that David Dorward wrote:
>libsfan01 wrote:
>>is it possible to position a div relative to the document window? so
for example if the page is scrolled down the div in question does not
move

position: fixed.
Not supported by MSIE.
JavaScript hacks to simulate it in that browser are available. Google can
help you find them.
Fixed elements are supported by IE7 in strict mode, it acts like IE6 in
quirks mode. I use the Fixed element simulator with one of my pages, and
while it does work I feel it's kind of ugly.
Then use position:fixed in IE7 and let IE6 users migrate.

Or, something like this:

<div style="top:0px;left:0px">Top Div</div>
<div style="top:20px;left:0px;overflow:scroll">Put your page contents
here</div>

And let them scroll the div element instead of the body.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 28 '06 #4
On or about 8/28/2006 7:08 PM, it came to pass that Randy Webb wrote:
totalstranger said the following on 8/28/2006 5:57 PM:
>On or about 8/28/2006 3:58 PM, it came to pass that David Dorward wrote:
>>libsfan01 wrote:

is it possible to position a div relative to the document window? so
for example if the page is scrolled down the div in question does not
move

position: fixed.
Not supported by MSIE.
JavaScript hacks to simulate it in that browser are available. Google
can
help you find them.
Fixed elements are supported by IE7 in strict mode, it acts like IE6
in quirks mode. I use the Fixed element simulator with one of my
pages, and while it does work I feel it's kind of ugly.

Then use position:fixed in IE7 and let IE6 users migrate.

Or, something like this:

<div style="top:0px;left:0px">Top Div</div>
<div style="top:20px;left:0px;overflow:scroll">Put your page contents
here</div>

And let them scroll the div element instead of the body.
You can use IE's proprietary conditional comments to select the proper
CSS and make settings based upon the version of IE that's executing. The
comments are not processed by other browsers. I implemented this when I
wanted to get rid of my javascript sniff routine. This lets my site work
for most modern browsers.

A sample of what I use on my site follows. If it's IE6/5 the IE5.css
will cascade and override the Default.css.

<LINK REL="stylesheet" TYPE="text/css" HREF="CSS/Default.css"
<!--[if lte IE 6]>
<LINK REL="stylesheet" TYPE="text/css" HREF="CSS/IE5.css">
<![endif]-->
Aug 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
4
by: Jane Withnolastname | last post by:
I am trying to re-work an old site by replacing the html with css. On the main page, I have a logo image which I needed centred on the initial screen. I found the solution here:...
14
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These...
6
by: rajek | last post by:
I posted a similar question yesterday, but didn't get an answer that resolved the issue. (Thanks to those who tried though.) The background: I've read in books and online that if you have one...
17
by: George Hester | last post by:
http://tinyurl.com/5uj6w The lower middle icon the "block" should not drop down when the mouse is over it. How can I stop that? Also the navigation divs both top and bottom should follow the...
20
by: Geoffrey H. Goldberg | last post by:
I have made a remote control window which opens from its parent. On loading, the remote is positioned relative to the screen using window.moveTo(x,y). What I would like to happen is the remote...
2
by: Rob R. Ainscough | last post by:
I'm slowly (very slowly) working my way thru the bizarre and sadistic world of control positioning in MultiViews (ASP 2.0). I came across this to help me explain (or attempt to anyway) why my web...
5
by: aljamala | last post by:
Hi, I have a group of 5 tables laid out of the web page. 2 go on the left side and 3 on the right. These tables retrieve data from the database so the number of records (rows) returned varies....
6
by: Mark | last post by:
hi, i'm trying to position something in the top right corner of a container, but i can't seem to figure out how to get it working. here's the html <div class='thumb'><a href='image.jpg'><img...
2
by: TheCruelPanda | last post by:
Hey there. My name is Rowan, and it's been three weeks since I last used tables for an HTML design. Okay, I'm rather new to CSS and I have a big positioning problem here. It might not be a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.