Search code examples
htmlcsspositionfixed

How to manage css left property for fixed div


I have div inside a div (.konteineris2 and .feedback). When I use left:-200px in .feedback class, fixed div suddenly appears in the very left side of screen, outside .konteineris2. All I wanted it to move for 200px to the left outside .konteineris2, but not appear to the left screen border and then move 200px from that point.

HTML:

<div class="konteineris2">
   <div class="feedback">
   </div>
</div>

CSS:

.feedback{
   position:fixed;
   top:220px;
   width:100px;
   height:200px;
   background:white;
}
.konteineris2{
   width: 960px;
   height:700px;
   position:absolute;
   top:460px;
   padding-top:30px;
   pointer-events:none;
   overflow:hidden;
}

Any ideas how to manage it?


Solution

  • change position:absolute; to position:relative; in .konteineris2

    Add margin-left: -200px; in .feedback

    Check it on CodePen . I think you're looking for the same thing.