💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# CSS padding-bottom 属性 ## 实例 设置 p 元素的下内边距: ``` p { padding-bottom:2cm; } ``` (在页面底部可以找到更多实例) ## 浏览器支持 所有主流浏览器都支持 padding-bottom 属性。 注释:任何的版本的 Internet Explorer (包括 IE8)都不支持属性值 "inherit"。 ## 定义和用法 padding-bottom 属性设置元素的下内边距(底部空白)。 ### 说明 该属性设置元素下内边距的宽度。行内非替换元素上设置的下内边距不会影响行高计算,因此,如果一个元素既有内边距又有背景,从视觉上看可能延伸到其他行,有可能还会与其他内容重叠。不允许指定负内边距值。 注释:不允许使用负值。 | 默认值: | 0 | | --- | --- | | 继承性: | no | | --- | --- | | 版本: | CSS1 | | --- | --- | | JavaScript 语法: | _object_.style.paddingBottom="10px" | | --- | --- | ## 可能的值 | 值 | 描述 | | --- | --- | | _length_ | 规定以具体单位计的固定的下内边距值,比如像素、厘米等。默认值是 0px。 | | _%_ | 定义基于父元素宽度的百分比下内边距。此值不会如预期地那样工作于所有的浏览器中。 | | inherit | 规定应该从父元素继承下内边距。 | ## TIY 实例 [设置下内边距 1](/tiy/t.asp?f=csse_padding-bottom) 本例演示如何使用厘米值来设置单元格的下内边距。 ``` <html> <head> <style type="text/css"> td {padding-bottom: 2cm} </style> </head> <body> <table border="1"> <tr> <td> 这个表格单元拥有下内边距。 </td> </tr> </table> </body> </html> ``` [设置下内边距 2](/tiy/t.asp?f=csse_padding-bottom_percent) 本例演示如何使用百分比值来设置单元格的下内边距。 ``` <html> <head> <style type="text/css"> td { padding-bottom: 10% } </style> </head> <body> <table border="1"> <tr> <td> 这个表格单元拥有下内边距。 </td> </tr> </table> </body> </html> ``` ## 相关页面 CSS 教程:[CSS 内边距](/css/css_padding.asp "CSS 内边距") HTML DOM 参考手册:[paddingBottom 属性](/jsref/prop_style_paddingbottom.asp "HTML DOM paddingBottom 属性")