如何使用JavaScript设置元素的底边距?
使用JavaScript中的marginBottom属性来设置底部边距。
示例
您可以尝试运行以下代码以使用JavaScript设置元素的下边距-
<!DOCTYPE html>
<html>
<body>
<p id="myID">This is demo text.</p>
<button type="button" onclick="display()">Set bottom margin</button>
<script>
function display() {
document.getElementById("myID").style.marginBottom = "95px";
}
</script>
</body>
</html>热门推荐
10 病人祝福语老师寄语简短
11 新娘生孩子祝福语简短
12 婆婆66岁祝福语简短
13 今天孩子高考祝福语简短
14 送彩票生日祝福语简短
15 分别祝福语简短情话英文
16 画室揭牌仪式祝福语简短
17 女友妈妈生日祝福语简短
18 离别赠言离职祝福语简短