왼쪽 사용 버튼과 같이 위치가 지정된 요소의 왼쪽 위치를 설정하는 속성입니다.
예시
다음 코드를 실행하여 JavaScript로 배치된 요소의 왼쪽 위치를 설정할 수 있습니다 -
<!DOCTYPE html>
<html>
<head>
<style>
#myID {
position: absolute;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<p>This is Demo Text.</p>
<button type="button" id="myID" onclick="display()">Change Left Position</button>
<script>
function display() {
document.getElementById("myID").style.left = "150px";
}
</script>
</body>
</html>