Markus G. Markus G. - 5 months ago 64
Sass (Sass) Question

CSS/SASS method for fixing div

I hope you'll have an answer for me.
In CSS there's the property background-attachment: fixed; which looks really fancy, so my question is there any property which I can use to "fix" some divs with text's etc. in the document?
If not, how to solve it in Typescript?
I hope you know what I mean

Okay, i will try to describe it: with the property background-attachment: fixed; the background of a div is fixed but not it's content, so a parallax effect appears, like this: And know I wanted to know if it is possible to do the same with the content like texts etc.


Can you try it like this ?


<div class="fixedContainer">
    This is experimental
<div class="otherContainer"> </div>

And here goes your style


.fixedContainer {
    position: fixed;
    padding: 2em;
    left: 50%;
    top: 0%;
    transform: translateX(-50%);

.otherContainer {


Credit originally goes to : this link and stackoverflow user aaronk6 and Joseph Marikle at their posts :

this link and at this link respectively.