How to set first N children height to its parent m

2019-07-25 05:53发布

I have already asked a question and solved myself using jQuery, but I want to solve this using CSS.I'm using plain CSS.

Here is Answer.
@Mamun suggested me to ask a new question, so I have asked it again.
For details please refer question.

Update From Previous question

I have dynamically prepended divs (.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.).

Addition of first five div class (.class-row-notification)(children div) == max-height of class(.class-append-con)(parent div)

How to do that? If through CSS, it should be cross-browser.

Updated jsFiddle

Thank you.

标签: html css
1条回答
劫难
2楼-- · 2019-07-25 06:12

I tried somthing here and i think this is what you mean

.class-append-con :nth-child(-n+5) {
    height: 100%;
} 

Here is the example you wanted

查看更多
登录 后发表回答