Click here to Skip to main content
15,505,786 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
By default in JavaScript elements are positioned according to their top left most pixel. Is there any way I can change which pixel the element is positioned by? I'd like to position an element according to its bottom left corner instead of its top left corner.

What I have tried:

I've done a bit of Google searching and can't find any questions like this, though its completely possible that I'm just not searching the right keywords.
Updated 30-Aug-21 23:52pm

1 solution

That depends what you mean by "positioning".

Assuming you're using absolute positioning, you can specify any of the top, left, bottom, and right properties. So to position an element 20px from the bottom left of its container:
.container {
    position: relative;
.child {
    position: absolute;
    bottom: 20px;
    left: 20px;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900