overflow:hidden ignoring bottom padding

后端 未结 10 2279
北海茫月
北海茫月 2020-12-14 15:50

In the following example, the bottom padding is ignored, and the text flows to the bottom of the element before hiding. What is causing this?

10条回答
  •  情书的邮戳
    2020-12-14 16:37

    Really late answer, but I want to give a really fresh and elegant solution with CSS. One could involve ::after pseudo-elements, but a more sustainable solution is:

        #mydiv p:last-child{
            margin-bottom:50px;
        }
    

    assuming the div can have an id or a class to be identified with. In this solution the last

    element will fill the missing bottom space.

    No more nested nodes and fiddling with HTML! Yuppie!

提交回复
热议问题