1、父元素相对定位
2、子元素绝对定位
.parent {
position: relative;
height: 200px; /* 或者任意高度 */
border: 1px solid #000; /* 仅为了可视化 */
}
.child {
position: absolute;
bottom: 0;
width: 100%; /* 或者指定宽度 */
}
记录php学习日志
1、父元素相对定位
2、子元素绝对定位
.parent {
position: relative;
height: 200px; /* 或者任意高度 */
border: 1px solid #000; /* 仅为了可视化 */
}
.child {
position: absolute;
bottom: 0;
width: 100%; /* 或者指定宽度 */
}