- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hey all, i’m new to CSS and to the forum so bare with me :)
I wonder can someone help me with a problem. I’m trying to get an object to remain fixed to the left side of my site regardless of scrolling. I’ve set the position to “fixed” and left to “0px”. Unfortunately this fixes it to the far left of the browser, not the site (my site is only 980px wide). Is there a way i can get it to stay fixed/stuck to the left side of the site as opposed to the browser window, and stay there when scrolling?
I’ve been trying for days and days with this one ! Thanks in hopeful advance, Mike
Fixed positioning is always in relation to the viewport.
It sounds like you have a wrapper which needs to be set to position relative
….then set the element you need to be stuck to position:absolute
.
Note however, that element will still scroll with the wrapper.
Other than that, you need to make a Codepen.io demo to show us what you are after.
If you search this site for positioning, Chris has a video on it.
I had a thought that if you really need fixed positioning, you can use calc
hey paulie
I’ve been away sorry for delayed response. Thanks so much for your reply, calc is definitely what i’m after, thanks for the heads up. Im new to CSS so the example you’ve sent through has really helped my journey .
Thanks again
Mike