如何使用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 生日祝福语舅舅 简短独特
13 恭喜园长升职祝福语简短
14 简短有力的结婚祝福语
15 新年留言老师祝福语简短
16 送给同桌的祝福语简短
17 高考祝福语 简短12字
18 给老人的祝福语简短