💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## bottom 属性 ### 属性定义及使用说明 对于绝对定位元素,bottom属性设置单位高于/低于包含它的元素的底边。 对于相对定位元素,bottom属性设置单位高于/低于其正常位置的元素的底边。 **注意**:如果"position:static",底部的属性没有任何效果。 **说明**:对于 static 元素,为 auto;对于长度值,则为相应的绝对长度;对于百分比数值,为指定值;否则为 auto。对于相对定义元素,如果 bottom 和 top 都是 auto,其计算值则都是 0;如果其中之一为 auto,则取另一个值的相反数;如果二者都不是 auto,bottom 将取 top 值的相反数。 JavaScript 语法:object.style.bottom="50px" * * * ## 属性值 | 值 | 描述 | | --- | --- | | auto | 默认值。通过浏览器计算底部的位置。 | | *%* | 设置以包含元素的百分比计的底边位置。可使用负值。 | | *length* | 使用 px、cm 等单位设置元素的底边位置。可使用负值。 | | inherit | 规定应该从父元素继承 bottom 属性的值。 | * * * ## 实例--设置图像的底部边缘,在元素的底边上面5px: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> img.ex1 { position:absolute; bottom:0px; } img.ex2 { position:relative; bottom:-100px; } </style> </head> <body> <img class="ex1" src="/attachments/cover/cover_css.png" width="95" height="84"> <h1>This is a heading</h1> <img class="ex2" src="/attachments/cover/cover_css.png" width="95" height="84"> </body> </html> ```