使用JavaScript中的marginLeft属性来设置左边距。您可以尝试运行以下代码以使用JavaScript设置元素的左边界-
<!DOCTYPE html>
<html>
<body>
<button type="button" onclick="display()">Add left margin</button>
<p id="myID">This is demo text.</p>
<script>
function display() {
document.getElementById("myID").style.marginLeft = "80px";
}
</script>
</body>
</html>