Lil CSS Help
- Started
- Last post
- 11 Responses
- ESKEMA
how do I make firefox (and perhaps ie, didn't tested it yet) to perform a position: fixed based on the parent and not the browser? in Safari and Chrome I simply don't input x and y and it locks fixed at the top left corner of its parent. I want to replicate this in firefox and probably others. How do I do this? I want to know!
- dbloc0
relative
- BabySnakes0
http://www.w3schools.com/cssref/…
Fixed is to the browser window, you may want to use relative on the parent and absolute on its children.
- 3030
#parent {
position: relative;
}#child {
position: absolute;
top: 0;
left: 0;
}
- ESKEMA0
^this will make it scroll vertically. I want it fixed vertically, but to move horizontally acording to it's parent..
- 3030
Any online examples that you have in mind?
- ESKEMA0
I want this in FF...
http://balas.pt/stuff/fixed.html…
- ESKEMA0
hmm.
seems the problem lies elsewhere because this lil html that I put up works in FF.. have to dig deeper..
- uan0
that even works in ie8 :)
- 3030
Works for me in FF and Chrome on Mac.
However, the element has position: fixed. At the moment, there are no props for left/top so it looks fine against the red box. Once those are set, black box is positioned relative to the browser window.If you don't like (or can't use) position: fixed you might use some JS plugins (ie jQuery) to the the job for you. You can use window.resize event then to adjust position accordingly.
- ESKEMA0
well, I played with the code a little, and something must have been named wrong because it works now.. woot woot!
- ESKEMA0
</thread>