Languages

Flexbox - how to set 100% height of each child inside component?

6 points
Asked by:
Wesley
501

I would like to fill container with children that have equal height and they are on the grid.

I have code:

Result:

 Questions:

1. How to remove vertical scrollbar? I don't want to set height to 99% :)

2. flex: 40% - How to remove flex: 40% and use some other flex param to achieve the same result?

2 answers
5 points
Answered by:
Root-ssh
178290

Grid box cound solve your problem too. 

  1. How to remove vertical scrollbar? I don't want to set height to 99% :)
    Ad. use correwct box model sizing: box-sizing: border-box; current approach
  2. flex: 40% - How to remove flex: 40% and use some other flex param to achieve the same result?
    Ad. That approach is good in your case, sometimes some programmers use calc() function too.

Example solution:

0 commentsAdd comment
5 points
Answered by:
kris_coder
21050

Answers:

1. How to remove vertical scrollbar? I don't want to set height to 99% :)

Answer: add body with margin: -1px and overflow: hidden

2. flex: 40% - How to remove flex: 40% and use some other flex param to achieve the same result?

Answer: that is correct solution.

Solution:

 

0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join