如何使用CSS将前N个孩子的身高设置为其父母的最大高度? [英] How to set first N children height to its parent max-height using CSS?
问题描述
我已经问过一个问题,并使用 jQuery
解决了自己的问题,但我想用 CSS
来解决问题。我使用纯CSS。
以下是答案。
@Mamun建议我问一个新问题,所以我再问一次。
详情请参阅问题。
<上一个问题的更新
我动态前置 div( 添加前五个div类( 如何做到这一点?如果通过CSS,它应该是跨浏览器的。 谢谢。 我在这里尝试了一些东西,我认为这就是你意思是 I have already asked a question and solved myself using Here is Answer. Update From Previous question I have dynamically prepended divs ( Addition of first five div class ( How to do that? If through CSS, it should be cross-browser. Thank you. I tried somthing here and i think this is what you mean Here is the example you wanted 这篇关于如何使用CSS将前N个孩子的身高设置为其父母的最大高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! .class-row-notification
)转换为另一个div( .class-append-con
)。
现在我想将前5个div height 设置为其父 max-height $ c $ (
, padding
, bottom-border $> c $ c>等)。
.class-row-notification
)( ( children div )== max-height
( .class- append-con
)(父div )
.class-append-con:nth-child(-n + 5){
height:100% ;
}
jQuery
, but I want to solve this using CSS
.I'm using plain CSS.
@Mamun suggested me to ask a new question, so I have asked it again.
For details please refer question..class-row-notification
) to another div (.class-append-con
).
Now I want to set first 5 divs height to its parent's max-height
(Including margin
, padding
, bottom-border
etc.). .class-row-notification
)(children div) == max-height
of class(.class-append-con
)(parent div).class-append-con :nth-child(-n+5) {
height: 100%;
}