## 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>
```
- CSS常用樣式控制
- background--背景
- Text--文本
- CSS屬性
- align-*
- animation-*
- appearance
- backface-visibility
- background
- background-attachment
- background-blend-mode
- background-clip
- background-color
- background-image
- background-origin
- background-position
- background-repeat
- background-size
- border
- border-bottom
- border-bottom-color
- border-bottom-left-radius
- border-bottom-right-radius
- border-bottom-style
- border-bottom-width
- border-collapse
- border-color
- border-image
- border-image-outset
- border-image-repeat
- border-image-source
- border-image-width
- Border-left
- border-left-color
- border-left-style
- border-left-width
- border-image-slice
- border-radius
- border-right
- border-right-color
- border-right-style
- border-right-width
- border-spacing
- border-style
- border-top
- border-top-color
- border-top-left-radius
- border-top-right-radius
- border-top-style
- border-top-width
- border-width
- bottom
- box-shadow
- box-sizing
- caption-side
- clear
- clip
- color
- column-count
- column-gap
- column-rule
- column-rule-color
- column-rule-style
- column-rule-width
- column-span
- column-width
- columns
- content
- counter-increment
- counter-reset
- cursor
- direction
- display
- Empty-cells
- filter(濾鏡)
- CSS 偽元素選擇器
- :active 選擇器
- :after 選擇器
- :before 選擇器
- :checked 選擇器
- :disabled 選擇器
- :empty 選擇器
- :enabled 選擇器
- :first-child 偽元素
- :first-letter 偽元素
- :first-line 偽元素
- :first-of-type 選擇器
- :focus 選擇器
- :hover 選擇器