ในการตั้งค่าตำแหน่งด้านล่างขององค์ประกอบที่มีตำแหน่งด้วย JavaScript ให้ใช้ ด้านล่าง ทรัพย์สิน
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีตั้งค่าตำแหน่งด้านล่าง −
<!DOCTYPE html>
<html>
<head>
<style>
#newBtn {
position: absolute;
}
</style>
</head>
<body>
<button type="button" id="newBtn" type="button" onclick="display()">Set Bottom Position</button>
<script>
function display() {
document.getElementById("newBtn").style.bottom = "400px";
}
</script>
</body>
</html>