css - 垂直对齐 DIV

标签 css html templates

假设我有 2 个 DIV,一个在彼此之上。

如何将顶部的文本对齐到 TOP ,并将底部的文本对齐到底部?

最佳答案

True -- vertical-align 仅在将每个 div 的 display 设置为 table-cell 时才有效

div#top, div#bottom { display: table-cell }
div#top { vertical-align: top }
div#bottom { vertical-align: bottom }

关于css - 垂直对齐 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2294064/

相关文章:

html - 如何防止表格在调整大小时溢出其封闭的 div?

javascript - 每次单击每个链接或 url 时如何更改我网站的背景图片?

javascript - 带有大图像的 Canvas drawImage

jquery - 恒星 js 不工作

C++ 模板类特化和结构

c++ - 基本模板 C++

jquery - 如何使用 jQuery 为 border-top-right-radius 的水平和垂直半径设置动画

JavaScript如何让这个html读取这个CSS并将我的脚本组织到表中

javascript - 我可以阻止中键单击打开链接以开始自动滚动吗?

C++/模板 : Can I selectively disable a function of a class at compile time?