且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在另一个 div 中水平放置两个 div

更新时间:2022-05-29 07:10:13

这是一个很常见的误解,认为底部需要 clear:both div,而实际上并不需要.虽然 Foxy 的回答是正确的,但您不需要那个非语义的、无用的清除 div.您需要做的就是将 overflow:hidden 粘贴到容器上:

Its quite a common misconception that you need a clear:both div at the bottom, when you really don't. While foxy's answer is correct, you don't need that non-semantic, useless clearing div. All you need to do is stick an overflow:hidden onto the container:

#sub-title { overflow:hidden; }