Closed. This question is opinion-based。它当前不接受答案。
想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。
2年前关闭。
我总是对最好的方法是在
在示例中,我希望文本位于底部和中央。我可以通过使用位置
有没有更好的方法可以避免使用
想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。
2年前关闭。
我总是对最好的方法是在
divs
中放置内容和div
感到困惑。.container {
width: 300px;
height: 500px;
background: #f5f5f5;
}
.content {
position: absolute;
bottom: 0px;
}
<div class="container">
<div class="content">
<h3>Title</h3>
</div>
</div>
在示例中,我希望文本位于底部和中央。我可以通过使用位置
absoulute
然后添加边距来实现。有没有更好的方法可以避免使用
absolute
,bottom
等left
坐标将内容从页面布局流中移出? 最佳答案
flex可以实现相同的目的。这是更新的CSS:-
.container {
width: 300px;
height: 500px;
background: #f5f5f5;
display: flex;
align-items: flex-end;
justify-content: center;
}
关于html - 放置在DIV内,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49408841/
10-15 23:26