The problem is as follows. They drove many "well-written" site. There is a site on the site information through flex. In one line, flex - there are two more nested ones, and there are 2 blocks in them, for a total of 4 blocks in one line (this was done, as I understood, so that when the screen size decreases, two blocks are output). Also there is a button More \ Less, which through the script in the inactive state displays 5 lines (half), in the active everything. The question is that when adapting part of the blocks sticks out from behind the edge of the parent element, how to organize the correct adaptation. The sources, for obvious reasons, I still can not throw off, but the screenshots and the link - I can. The screen of the problem itself: Adaptive screen

Link to this squalor. My working hosting So how can I edit this - tell me how can I solve this? There, along the way, the whole site is flushed on the flex, oh, how you do not want to turn everything around.

  • or which way to even dig? - Anton

1 answer 1

you have in style

section.education-speciality { max-height: 1726px; 

In my opinion, max-height in my case it is better to calculate using the calc function, for example for 5 rows

 max-height: calc(var(--box) * 5) 

if of course the block size is specified - box

  • Tell me, how can I display the var variable? Suppose I defined it in js, then substitute it in the script? Or to register in css, judging by your answer? - Anton
  • in ccs you write: root { - abooks abooks