默认情况下,原点始终位于元素的左上角。如果您希望将其锚定在左下角,则始终需要添加元素的高度以实现所需的结果。
elem.X = X;
elem.Y = Y + elem.height;
.player {
top: 200px; /* whatever value you want the bottom of element to be from top */
margin-top: -100%; /* bring the element back up so the bottom is where the top value set above is */
}
话虽如此,我建议在这里使用类似CSS表格或Flexbox的东西。