Set the bottom edge of the <div> element to 10px above the bottom edge of its nearest parent element with some positioning:
div.absolute {
position: absolute;
bottom: 10px;
width: 50%;
border: 3px solid #8AC007;
}
Try it Yourself »
The bottom
property affects the vertical position of a positioned element. This property has no effect on non-positioned elements.
bottom
property sets the bottom edge of an element to a unit above/below the bottom edge of its nearest positioned ancestor.bottom
property makes the element's bottom edge to move above/below its normal position.bottom
property behaves like its position is relative when the element is inside the viewport, and like its position is fixed when it is outside.bottom
property has no effect.Default value: | auto |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS2 |
JavaScript syntax: | object.style.bottom="10px" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
bottom | 1.0 | 5.0 | 1.0 | 1.0 | 6.0 |
bottom: auto|
length|initial|inherit;
Value | Description | Demo |
---|---|---|
auto | Lets the browser calculate the bottom edge position. This is default | Demo ❯ |
length | Sets the bottom edge position in px, cm, etc. Negative values are allowed. Read about length units | Demo ❯ |
% | Sets the bottom edge position in % of containing element. Negative values are allowed | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS tutorial: CSS Positioning
CSS reference: top property
CSS reference: left property
CSS reference: right property
HTML DOM reference: bottom property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!