在 CSS 中,我们经常会遇到需要将文字置于底部的情况,比如在设计页面底部的版权信息时。下面就介绍一下如何通过 CSS 实现文字置底的效果。首先,我们可以使用绝对定位来把文字置于底部。假设我们有一个父
div { position: relative; height: 200px; /* 假设 div 的高度为 200px */ } div p { position: absolute; bottom: 0; }
div { display: flex; flex-direction: column; justify-content: flex-end; height: 200px; /* 假设 div 的高度为 200px */ }
代码演示: div { position: relative; height: 200px; } div p { position: absolute; bottom: 0; } div { display: flex; flex-direction: column; justify-content: flex-end; height: 200px; }
粉丝
0
关注
0
收藏
0