I wanted to position the blue div relative to the red div.
I used the absolute position for the blue div but it didn’t move relative to the red div
this is the html code.
.mench {
display: inline-block;
height: 50px;
width: 50px;
}
<div class="mench" style="position: fixed;top: 25px; left: 100px; background-color: red;"></div>
<div class="mench" style="position: absolute; left: 25px; background-color: blue;"></div>
4
Answers
Just remove ‘top: 25px’ from the red div
I understand that you’re looking for clarification on what to do in case the answer I provided isn’t aligned with what you were expecting. To address this situation, here’s a clearer way to convey the information:
If the response I’ve given doesn’t match the answer you had in mind, here’s what you can do: Please feel free to provide additional context or ask follow-up questions to guide me better. This will help me understand your perspective and provide you with a more accurate and satisfactory response. Your input is valuable, and I’m here to assist you to the best of my abilities.