zoukankan      html  css  js  c++  java
  • HTML DOM Style marginBottom 属性

    [

    Style marginBottom 属性
    Style 对象

    定义和用法

    marginBottom 属性设置或返回元素的下外边距。

    语法

    设置 marginBottom 属性:

    Object.style.marginBottom="%|length|auto|inherit"

    返回 marginBottom 属性:

    Object.style.marginBottom

    描述
    % 定义基于父元素宽度的百分比下外边距。
    length 使用 px、cm 等单位定义下外边距的宽度。
    auto 浏览器设定的下外边距。
    inherit 下外边距从父元素继承。

    浏览器支持

    所有主要浏览器都支持 marginBottom 属性。
    注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有规定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。

    提示和注释

    margin 属性和 padding 属性都是在元素周围插入空间。然而,不同的是,margin 将围绕边框外面插入空间,padding 将在元素边框内插入空间。

    实例

    实例

    更改 div 元素的下外边距:

    
    <!DOCTYPE html>
    
    <html>
    
    <head> 
    
    <meta charset="utf-8"> 
    
    <title>Break易站(runoob.com)</title> 
    
    <style type="text/css">
    
    div{
    
        border: 1px solid #FF0000;
    
    }
    
    </style>
    
    <script>
    
    function changeMargin(){
    
        document.getElementById("ex1").style.marginBottom="100px";
    
    }
    
    function changePadding(){
    
        document.getElementById("ex2").style.paddingBottom="100px";
    
    }
    
    </script>
    
    </head>
    
    <body>
    
    
    <div id="ex1">这是一些文本。</div>
    
    <br>
    
    <button type="button" onclick="changeMargin()">修改div元素的底部外间距</button>
    
    <br>
    
    <br>
    
    <div id="ex2">这是一些文本。</div>
    
    <br>
    
    <button type="button" onclick="changePadding()">修改div元素的底部内间距</button>
    
    
    </body>
    
    </html>
    
    

    Style 对象

    ]
    转载请保留页面地址:https://www.breakyizhan.com/html/22354.html
  • 相关阅读:
    layer弹出层显示在top顶层
    PC上安装多个操作系统
    Windows下DLL查找顺序
    AHCI驱动安装
    Office 多版本共存
    Windows定时器
    Windows菜单
    Windows高精度时间
    VB6.0调用DLL
    时间服务器通讯协议
  • 原文地址:https://www.cnblogs.com/breakyizhan/p/13295750.html
Copyright © 2011-2022 走看看