I am trying to position an element relative to the window using fixed positioning, but I have encountered a strange behavior in one specific case.
Here is the code snippet I am working with:
<div style="
padding-left: 5px;
padding-right: 5px;
margin-left: 50%;
transform: translateX(-50%);
display: inline-block;
max-width: 300px;
width: 300px;
background-color: red">
something
<div style="width: 100px; height: 100px; background-color: blue; position: fixed; left: 0">
Gallery
</div>
</div>
In the above code, the second element is intended to be fixed and located inside the first element. However, the 'translate' property seems to also affect the fixed child elements. How can I correct this issue?
For reference, here is the link to the fiddle: Fiddle