6 replies [Last post]
Maujor
Maujor's picture
Offline
Regular
Rio de Janeiro, Brazil
Last seen: 2 years 38 weeks ago
Rio de Janeiro, Brazil
Timezone: GMT-2
Joined: 2003-11-21
Posts: 46
Points: 2

Hi,

A background image "fixed" using background-attachment:fixed; is fixed with respect viewport according CSS recommendations (for Netscape its work nice).
Are there a way "to fix" an image with respect an element (say a DIV) in NN?

Maurício "Maujor®" Samy Silva
Site: http://maujor.com
Books: http://livrosdomaujor.com.br

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 5 days 23 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Netscape background-attachment property

Hi Maujor,
If you position the containing div relative or absolutely you should be able to position the image from the top left corner.

<div style="position:relative; width:300px; height:300px;">
<img src="image.gif" style="position:relative; top: 20px; left:10px;" /> 
</div>


hope that helps

Maujor
Maujor's picture
Offline
Regular
Rio de Janeiro, Brazil
Last seen: 2 years 38 weeks ago
Rio de Janeiro, Brazil
Timezone: GMT-2
Joined: 2003-11-21
Posts: 46
Points: 2

Netscape background-attachment property

Hi Tony,
Thanks. I really appreciate your attention.
May be I wasn't clear on my question.
Your code causes de image scroll together the content div.
I'm looking for a "fixed" (non scrolling) background image within a div element locate anywhere on the screen and working in Netscape.

The following code works nice in MSIE, ("fix" the image at top:0; left:0; with respect the div) but Netscape, do not display the image!!! (it is located at top:0px; left:0px with respect the viewport. If you set top:0;left:0; for "mydiv" you can see the image in NN)

<div id="mydiv" style="position:absolute; top:100px;left:100px;width:260px; height:200px; z-index:10; background:url('image.gif') no-repeat fixed; border: 2px solid #000; overflow: scroll; visibility: visible;"> 
<p>Here content bla...bla..bla...</p>
</div>

Maurício "Maujor®" Samy Silva
Site: http://maujor.com
Books: http://livrosdomaujor.com.br

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 5 days 23 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Netscape background-attachment property

Hi Maujor,
Now I think I understand.
Background-attachment:fixed;will work in IE and should work in Netscape > 6, but the background-image seems to disappear when no-repeat is used Sad or any repeat value apart from repeat.
I had never noticed that before.
Is that what you are experiencing ?

Maujor
Maujor's picture
Offline
Regular
Rio de Janeiro, Brazil
Last seen: 2 years 38 weeks ago
Rio de Janeiro, Brazil
Timezone: GMT-2
Joined: 2003-11-21
Posts: 46
Points: 2

Netscape background-attachment property

Yes Tony, that is!! Shock Laughing out loud
Eric Meyer at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html The Complexspiral Demo teach us that the demo works in NN because the fixed value for background property in NN works with respect the viewport and for IE it not work.
Take a look at Eric Meyer Demo.

There are a java script code: fixed.js fix fixed positioning and fixed backgrounds in IE/Win // version 1.8, 08-Aug-2003 // written by Andrew Clover that forces IE works like NN.

I'm trying do force NN works like IE for that property. Shock

PS: Sorry about my poor english and thanks for your patience

Maurício "Maujor®" Samy Silva
Site: http://maujor.com
Books: http://livrosdomaujor.com.br

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 5 days 23 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Netscape background-attachment property

Hi Maujor,
Can you add the background to the body and position it from the top left corner of the browser.
That should work the same in IE and Netscape.

Maujor
Maujor's picture
Offline
Regular
Rio de Janeiro, Brazil
Last seen: 2 years 38 weeks ago
Rio de Janeiro, Brazil
Timezone: GMT-2
Joined: 2003-11-21
Posts: 46
Points: 2

Netscape background-attachment property

Yes Tony,
Certain it'll work nice!
But, if I've more than one div for attach differents backgrounds Sad
I do not pick yet a solution for this question! May be it's impossible.
Best Regards and thanks again.

Maurício "Maujor®" Samy Silva
Site: http://maujor.com
Books: http://livrosdomaujor.com.br