css div 底部对齐
The bottom property in CSS is useful to change the vertical position of the positioned element. This property has no effects on non-positioned elements.
CSS中的bottom属性对于更改已定位元素的垂直位置很有用。 此属性对未定位的元素没有影响。
Basic syntax:
基本语法:
Element{
bottom:length;
}
Below are the consequences of different position values on the bottom property of div,
以下是div的bottom属性对不同位置值的影响,
位置:绝对|固定 (position:absolute|fixed)
When the value of the position is absolute or fixed then the bottom property is useful to set the bottom edge of an element to a unit above or below the bottom edge of its nearest positioned element.
当位置的值是绝对值或固定值时,bottom属性可用于将元素的底边设置为最接近其元素的底边的上方或下方的单位。
Syntax:
句法:
Element{
bottom:length;
position:fixed;
}
Example:
例:
<!DOCTYPE html>
<html>
<head>
<style>
.div0 {
background: pink;
padding: 10px;
width: 360px;
height: 40px;
}
.div1,
.div2,
.div3 {
float: left;
background: yellow;
border: 2px solid green;
width: 115px;
}
.div2 {
position: fixed;
bottom: 5px;
}
</style>
</head>